larroy commented on a change in pull request #15120: [bug] fix higher grad log
URL: https://github.com/apache/incubator-mxnet/pull/15120#discussion_r290528016
##########
File path: src/operator/tensor/elemwise_unary_op_basic.cc
##########
@@ -1074,16 +1074,19 @@
MXNET_OPERATOR_REGISTER_BINARY_WITH_SPARSE_CPU_DR(_backward_log,
[](const nnvm::NodePtr& n, const std::vector<nnvm::NodeEntry>& ograds) {
// For f(x) -> f = log
// f''(x) = -1 * (f'(x) * f'(x))
- auto gx = nnvm::NodeEntry{n};
+ auto gx_mul_head_grads = nnvm::NodeEntry{n}; // f'(x) * head_grads
+ auto head_grads = nnvm::NodeEntry{n->inputs[0]};
+ auto g_lx = MakeNode("reciprocal", n->attrs.name + "_backward_log_grad",
Review comment:
can we add a comment about the inputs and what is g_lx? it would help
reason about the code. Are the inputs of n (backward_log)
- 0: input gradient
- 1: x
?
So g_lx is a node having 1/x ? or the derivative of the log right? can we
rename to g_logx ?
----------------------------------------------------------------
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:
[email protected]
With regards,
Apache Git Services