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

Fix MKLDNN sigmoid/softrelu issue #10336

Merged
merged 5 commits into from
Apr 2, 2018
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/operator/nn/activation.cc
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ void ActivationGradComputeExCPU(const nnvm::NodeAttrs& attrs,
const ActivationParam& param = nnvm::get<ActivationParam>(attrs.parsed);
if (SupportMKLDNN(inputs[0])) {
MKLDNN_OPCHECK_INIT(true, outputs.size(), inputs, outputs);
MKLDNNActivationBackward(attrs, ctx, inputs[0], inputs[1], req[0],
MKLDNNActivationBackward(attrs, ctx, inputs[0], inputs[2], req[0],
outputs[0]);
Copy link
Contributor

Choose a reason for hiding this comment

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

inputs[2] doesn't exist. You need to modify ActivationGrad to pass input data to backward.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Thanks for the comments, have updated diff to pass input data and updated a few other functions as well.

MKLDNN_OPCHECK_RUN(ActivationGradCompute<cpu>, attrs, ctx, inputs, req, outputs);
return;
Expand Down
6 changes: 1 addition & 5 deletions src/operator/nn/mkldnn/mkldnn_act.cc
Original file line number Diff line number Diff line change
Expand Up @@ -43,13 +43,9 @@ namespace mxnet {
namespace op {

bool SupportMKLDNNAct(const ActivationParam& param) {
// We only enable ReLU for now. It seems other activations have some precision
// problems.
return param.act_type == activation::kReLU;
#if 0
return param.act_type == activation::kReLU
|| param.act_type == activation::kSigmoid
|| param.act_type == activation::kSoftReLU;
Copy link
Member

Choose a reason for hiding this comment

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

Why tanh is not enabled?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@TaoLv I added support for Tanh and it can pass UT

#endif
}

static inline mkldnn::algorithm GetMKLDNNActAlgo(const ActivationParam& param) {
Expand Down