ptrendx commented on a change in pull request #18622:
URL: https://github.com/apache/incubator-mxnet/pull/18622#discussion_r457724415



##########
File path: src/operator/numpy/np_elemwise_broadcast_op_extended.cc
##########
@@ -201,16 +201,12 @@ 
MXNET_OPERATOR_REGISTER_NP_BINARY_SCALAR(_npi_copysign_scalar)
 
 MXNET_OPERATOR_REGISTER_NP_BINARY_SCALAR(_npi_rcopysign_scalar)
 .set_attr<FCompute>("FCompute<cpu>", BinaryScalarOp::Compute<cpu, 
mshadow_op::rcopysign>)
-.set_attr<nnvm::FGradient>("FGradient", 
ElemwiseGradUseIn{"_backward_npi_rcopysign_scalar"});
+.set_attr<nnvm::FGradient>("FGradient", MakeZeroGradNodes);

Review comment:
       Because `rcopysign_grad` is 0 :-): 
https://github.com/apache/incubator-mxnet/blob/master/src/operator/mshadow_op.h#L777
   
   I noticed this when adding the RTC version, so figured instead of adding a 
custom code for zero it is better to reuse the existing mechanism to handle the 
case when gradients are 0.




----------------------------------------------------------------
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:
us...@infra.apache.org


Reply via email to