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/04/04 05:44:57 UTC
[GitHub] [incubator-mxnet] apeforest commented on a change in pull request
#14613: [MXNET-978] Higher order gradient support for some unary operators
apeforest commented on a change in pull request #14613: [MXNET-978] Higher order gradient support for some unary operators
URL: https://github.com/apache/incubator-mxnet/pull/14613#discussion_r272024151
##########
File path: src/imperative/imperative.cc
##########
@@ -347,8 +347,9 @@ std::vector<NDArray*> Imperative::Backward(
x_reqs.push_back(info.grad_req);
info.fresh_out_grad = true;
}
- CHECK_GT(xs.size(), 0)
- << "There are no inputs in computation graph that require gradients.";
+ if (xs.empty()) {
Review comment:
Current backward operation requires an operator must have at least one inputs, because the gradient of a constants is always zero. However, the second order of some operators such as relu is actually gradient of a constant (ones or zeros). Therefore we need to support gradient for constant operators.
----------------------------------------------------------------
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