Skip to content
This repository has been archived by the owner on Nov 17, 2023. It is now read-only.

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

Merged
merged 6 commits into from
Jul 23, 2020

Conversation

ChaiBapchya
Copy link
Contributor

  • 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

Description

(Brief description on what this PR is about)

Checklist

Essentials

Please feel free to remove inapplicable items for your PR.

  • The PR title starts with [MXNET-$JIRA_ID], where $JIRA_ID refers to the relevant JIRA issue created (except PRs with tiny changes)
  • Changes are complete (i.e. I finished coding on this PR)
  • All changes have test coverage:
  • Unit tests are added for small changes to verify correctness (e.g. adding a new operator)
  • Nightly tests are added for complicated/long-running ones (e.g. changing distributed kvstore)
  • Build tests will be added for build configuration changes (e.g. adding a new build option with NCCL)
  • Code is well-documented:
  • For user-facing API changes, API doc string has been updated.
  • For new C++ functions in header files, their functionalities and arguments are documented.
  • For new examples, README.md is added to explain the what the example does, the source of the dataset, expected performance on test set and reference to the original paper if applicable
  • Check the API doc at https://mxnet-ci-doc.s3-accelerate.dualstack.amazonaws.com/PR-$PR_ID/$BUILD_ID/index.html
  • To the best of my knowledge, examples are either not affected by this change, or have been fixed to be compatible with this change

Changes

  • Feature1, tests, (and when applicable, API doc)
  • Feature2, tests, (and when applicable, API doc)

Comments

  • If this change is a backward incompatible change, why must this change be made.
  • Interesting edge cases to note here

* 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
@mxnet-bot
Copy link

Hey @ChaiBapchya , Thanks for submitting the PR
All tests are already queued to run once. If tests fail, you can trigger one or more tests again with the following commands:

  • To trigger all jobs: @mxnet-bot run ci [all]
  • To trigger specific jobs: @mxnet-bot run ci [job1, job2]

CI supported jobs: [windows-gpu, unix-cpu, unix-gpu, centos-cpu, centos-gpu, website, sanity, miscellaneous, windows-cpu, clang, edge]


Note:
Only following 3 categories can trigger CI :PR Author, MXNet Committer, Jenkins Admin.
All CI tests must pass before the PR can be merged.

@ChaiBapchya ChaiBapchya changed the title [Bug Fixed] Fix batch norm when grad_req is add (#18500) [v1.6.x][Bug Fixed] Fix batch norm when grad_req is add (#18500) Jul 14, 2020
@wkcn
Copy link
Member

wkcn commented Jul 15, 2020

Hi @ChaiBapchya , the PR #18500 needs to be modified to fit the old version of MXNet.
We can backport the modified PR for MXNet v1.x: #18518

ChaiBapchya and others added 2 commits July 15, 2020 09:54
…eq is `add` (apache#18518)

* Fix batch norm when grad_req is

* fix

* remove softmax test

* fix
@ChaiBapchya ChaiBapchya changed the title [v1.6.x][Bug Fixed] Fix batch norm when grad_req is add (#18500) [v1.6.x][Bug Fixed] Fix batch norm when grad_req is add (#18518) Jul 15, 2020
@ChaiBapchya
Copy link
Contributor Author

@wkcn cherry-picking 1.x into 1.6 doesn't quite resolve CI issues.. any idea?

@wkcn
Copy link
Member

wkcn commented Jul 22, 2020

Hi @ChaiBapchya ,
I found a compilation error in http://jenkins.mxnet-ci.amazon-ml.com/blue/organizations/jenkins/mxnet-validation%2Funix-cpu/detail/PR-18714/3/pipeline

[2020-07-18T22:39:10.415Z] src/operator/quantization/mkldnn/../../nn/mkldnn/mkldnn_batch_norm-inl.h: In function 'void mxnet::op::MKLDNNBatchNormBackward(const mxnet::OpContext&, const mxnet::op::BatchNormParam&, const std::vector<mxnet::NDArray>&, const std::vector<mxnet::NDArray>&, const std::vector<mxnet::NDArray>&, const std::vector<mxnet::OpReqType>&, const std::vector<mxnet::NDArray>&, const std::vector<mxnet::NDArray>&)':

[2020-07-18T22:39:10.415Z] src/operator/quantization/mkldnn/../../nn/mkldnn/mkldnn_batch_norm-inl.h:383:36: error: 'copy_size' was not declared in this scope

[2020-07-18T22:39:10.415Z]            memcpy(w_grad_1, gw_buf, copy_size);

[2020-07-18T22:39:10.415Z]                                     ^

[2020-07-18T22:39:10.415Z] src/operator/quantization/mkldnn/../../nn/mkldnn/mkldnn_batch_norm-inl.h:399:46: error: 'copy_size' was not declared in this scope

[2020-07-18T22:39:10.415Z]          memcpy(w_grad_2, &gw_buf[channels_], copy_size);

[2020-07-18T22:39:10.415Z]                                               ^

[2020-07-18T22:39:10.415Z] Makefile:555: recipe for target 'build/src/operator/quantization/mkldnn/mkldnn_quantized_batch_norm.o' failed

@wkcn
Copy link
Member

wkcn commented Jul 23, 2020

Hi @ChaiBapchya , all tests passed : )

@ChaiBapchya
Copy link
Contributor Author

@wkcn Appreciate your help with this cherry-pick. Changes look good to me. Can we merge it?

@wkcn
Copy link
Member

wkcn commented Jul 23, 2020

@ChaiBapchya , This PR looks good to me too. : )

@leezu leezu merged commit c765931 into apache:v1.6.x Jul 23, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants