haojin2 commented on a change in pull request #11827: fix for bug #10868: 
_backward_softsign activation is incorrect
URL: https://github.com/apache/incubator-mxnet/pull/11827#discussion_r203842648
 
 

 ##########
 File path: src/operator/nn/activation.cc
 ##########
 @@ -44,11 +44,18 @@ struct ActivationGrad {
                                           const std::vector<nnvm::NodeEntry>& 
ograds) const {
     std::vector<nnvm::NodeEntry> heads(ograds.begin(), ograds.end());
     heads.emplace_back(nnvm::NodeEntry{n, activation::kOut, 0});
-#if (MXNET_USE_CUDNN == 1 || MXNET_USE_MKLDNN == 1)
+
     const NodeAttrs& attrs = n->attrs;
+    if (dmlc::get<ActivationParam>(attrs.parsed).act_type == 
activation::kSoftSign) {
+      // for softsign need the inputs to compute the activation.
+      heads.push_back(n->inputs[activation::kData]);
+    }
+
+#if (MXNET_USE_CUDNN == 1 || MXNET_USE_MKLDNN == 1)
     // for ReLU, no need to pass input data. This enables inplace optimization 
during the
     // forward pass.
-    if (dmlc::get<ActivationParam>(attrs.parsed).act_type != 
activation::kReLU) {
+    if (dmlc::get<ActivationParam>(attrs.parsed).act_type != activation::kReLU 
&&
+       dmlc::get<ActivationParam>(attrs.parsed).act_type != 
activation::kSoftSign) {
 
 Review comment:
   nit: alignment with the line above:
   ```
   if (dmlc ...
       dmlc ...)
   ```

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
[email protected]


With regards,
Apache Git Services

Reply via email to