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

Fix axis Bug in MKLDNN Softmax #11335

Merged
merged 5 commits into from
Jun 20, 2018
Merged

Fix axis Bug in MKLDNN Softmax #11335

merged 5 commits into from
Jun 20, 2018

Conversation

xinyu-intel
Copy link
Contributor

@xinyu-intel xinyu-intel commented Jun 19, 2018

Description

Apply CheckAxis to MKLDNN Softmax function in order to call MKLDNN correctly.

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 http://mxnet-ci-doc.s3-accelerate.dualstack.amazonaws.com/PR-$PR_ID/$BUILD_ID/index.html
  • To the my best knowledge, examples are either not affected by this change, or have been fixed to be compatible with this change

@pengzhao-intel @TaoLv

@@ -38,10 +38,9 @@ static void SoftmaxComputeExCPU(const nnvm::NodeAttrs& attrs,
const std::vector<NDArray>& inputs,
const std::vector<OpReqType>& req,
const std::vector<NDArray>& outputs) {
const SoftmaxParam& param = nnvm::get<SoftmaxParam>(attrs.parsed);
// It seems MKLDNN softmax doesn't support training.
// and it only supports non-negative axis.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

please also remove this comment.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We are not using the latest MKLDNN.

Copy link
Member

@szha szha left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Test?

@xinyu-intel
Copy link
Contributor Author

@szha unit tests with negative axis have been added and passed.

@szha szha merged commit 6307c00 into apache:master Jun 20, 2018
@TaoLv
Copy link
Member

TaoLv commented Jun 20, 2018

@szha what's the difference of softmax/log_softmax/SoftmaxActivation in mxnet? and which one is the most widely used by mxnet users? Seems only softmax is optimized here with mkldnn primitive.

@szha
Copy link
Member

szha commented Jun 20, 2018

right, the SoftmaxActivation is an older operator and is not actively developed anymore. Going forward we are using softmax/log_softmax.

@TaoLv
Copy link
Member

TaoLv commented Jun 21, 2018

zheng-da pushed a commit to zheng-da/incubator-mxnet that referenced this pull request Jun 28, 2018
* add softmax imporvement

* reuse CheckAxis code

* update comment

* add tests with negative axis
XinYao1994 pushed a commit to XinYao1994/incubator-mxnet that referenced this pull request Aug 29, 2018
* add softmax imporvement

* reuse CheckAxis code

* update comment

* add tests with negative axis
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.

3 participants