[v1.6.x][Bug Fixed] Fix batch norm when grad_req is `add` (#18518) (#18714)

* [Bug Fixed] Fix batch norm when grad_req is `add` (#18500)

* fix batch norm when fix_gamma is True

* support gradient accumulation for batch norm

* mkldnn batchnorm support grad add

* unittest for bn

* fix bn arg

* fix lint

* fix mkldnn

* fix mkldnn bn

* fix grad when fixing gamma

* fix naive gpu bn

* fix lint

* fix cudnn bn

* fix flag

* fix lint

* fix testcase

* fix

* use @pytest.mark.parametrize

* combination

* remove redundant test in batchnorm

* npx.batch_norm test

* try to fix test

* reduce the number of tests for batchnorm

* fix

* Revert "[Bug Fixed] Fix batch norm when grad_req is `add` (#18500)"

This reverts commit 8e32cd6959461290c1698e02466fcc16f61ad237.

* [v1.x] backport #18500 - [Bug Fixed] Fix batch norm when grad_req is `add` (#18518)

* Fix batch norm when grad_req is

* fix

* remove softmax test

* fix

* add copy_size

* Fix init method for TestBatchNorm

Co-authored-by: JackieWu <wkcn@live.cn>
7 files changed
tree: e1c723f492d1e136f4235f0bbccacf9f60c10a21
  1. .clang-tidy
  2. .codecov.yml
  3. .gitattributes
  4. .github/
  5. .gitignore
  6. .gitmodules
  7. .mxnet_root
  8. .travis.yml
  9. 3rdparty/
  10. CMakeLists.txt
  15. KEYS
  18. Makefile
  19. NEWS.md
  20. NOTICE
  21. R-package/
  22. README.md
  23. SECURITY.md
  24. amalgamation/
  25. appveyor.yml
  26. benchmark/
  27. cd/
  28. ci/
  29. cmake/
  30. contrib/
  31. cpp-package/
  32. dev_menu.py
  33. docker/
  34. docs/
  35. example/
  36. include/
  37. julia/
  38. make/
  39. matlab/
  40. mkldnn.mk
  41. perl-package/
  42. plugin/
  43. python/
  44. readthedocs.yml
  45. scala-package/
  46. setup-utils/
  47. snap.python
  48. snapcraft.yaml
  49. src/
  50. tests/
  51. tools/

Apache MXNet (incubating) for Deep Learning

CentOS CPU Build Status CentOS GPU Build Status Clang Build Status
Edge Build Status Miscellaneous Build Status Sanity Build Status
Unix CPU Build Status Unix GPU Build Status Website Build Status
Windows CPU Build Status Windows GPU Build Status
Documentation StatusGitHub license


Apache MXNet (incubating) is a deep learning framework designed for both efficiency and flexibility. It allows you to mix symbolic and imperative programming to maximize efficiency and productivity. At its core, MXNet contains a dynamic dependency scheduler that automatically parallelizes both symbolic and imperative operations on the fly. A graph optimization layer on top of that makes symbolic execution fast and memory efficient. MXNet is portable and lightweight, scaling effectively to multiple GPUs and multiple machines.

MXNet is more than a deep learning project. It is a collection of blue prints and guidelines for building deep learning systems, and interesting insights of DL systems for hackers.

Ask Questions

How to Contribute

What's New



  • Design notes providing useful insights that can re-used by other DL projects
  • Flexible configuration for arbitrary computation graph
  • Mix and match imperative and symbolic programming to maximize flexibility and efficiency
  • Lightweight, memory efficient and portable to smart devices
  • Scales up to multi GPUs and distributed setting with auto parallelism
  • Support for Python, Scala, C++, Java, Clojure, R, Go, Javascript, Perl, Matlab, and Julia
  • Cloud-friendly and directly compatible with AWS S3, AWS Deep Learning AMI, AWS SageMaker, HDFS, and Azure


Licensed under an Apache-2.0 license.

Reference Paper

Tianqi Chen, Mu Li, Yutian Li, Min Lin, Naiyan Wang, Minjie Wang, Tianjun Xiao, Bing Xu, Chiyuan Zhang, and Zheng Zhang. MXNet: A Flexible and Efficient Machine Learning Library for Heterogeneous Distributed Systems. In Neural Information Processing Systems, Workshop on Machine Learning Systems, 2015


MXNet emerged from a collaboration by the authors of cxxnet, minerva, and purine2. The project reflects what we have learned from the past projects. MXNet combines aspects of each of these projects to achieve flexibility, speed, and memory efficiency.