You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@mxnet.apache.org by GitBox <gi...@apache.org> on 2019/06/18 04:55:35 UTC

[GitHub] [incubator-mxnet] apeforest commented on a change in pull request #15253: Add higher order gradient support `sigmoid`, `tan`, `tanh`

apeforest commented on a change in pull request #15253: Add higher order gradient support `sigmoid`, `tan`, `tanh`
URL: https://github.com/apache/incubator-mxnet/pull/15253#discussion_r294609295
 
 

 ##########
 File path: src/operator/tensor/elemwise_unary_op_basic.cc
 ##########
 @@ -121,7 +121,20 @@ The storage type of ``sigmoid`` output is always dense
 .set_attr<nnvm::FGradient>("FGradient", ElemwiseGradUseOut{"_backward_sigmoid"});
 
 MXNET_OPERATOR_REGISTER_BINARY_WITH_SPARSE_CPU(_backward_sigmoid,
-                                               unary_bwd<mshadow_op::sigmoid_grad>);
+                                               unary_bwd<mshadow_op::sigmoid_grad>)
+.set_attr<nnvm::FGradient>("FGradient",
+  [](const nnvm::NodePtr& n, const std::vector<nnvm::NodeEntry>& ograds) {
+    auto fx = nnvm::NodeEntry{n->inputs[1]};
+    auto gx_ograd = nnvm::NodeEntry{n};
+
+    std::vector<nnvm::NodeEntry> ret;
+       
+    ret.emplace_back(MakeNode("elemwise_mul", n->attrs.name + "_backward_grad_grad_inp",
 
 Review comment:
   Shouldn't the first item be _backward_grad_grad and the second item be _backward_grad_grad_inp?
   
   Given that:
   ```
   n->input[0]:  ygrad
   n->input[1]: y
   ```
   

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


With regards,
Apache Git Services