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/09/20 06:33:49 UTC

[GitHub] [incubator-mxnet] ZhennanQin commented on a change in pull request #16025: Numpy add numpy op left_shift and right_shift

ZhennanQin commented on a change in pull request #16025: Numpy add numpy op left_shift and right_shift
URL: https://github.com/apache/incubator-mxnet/pull/16025#discussion_r326488169
 
 

 ##########
 File path: src/operator/numpy/np_elemwise_broadcast_op.cc
 ##########
 @@ -144,5 +165,21 @@ MXNET_OPERATOR_REGISTER_NP_BINARY_SCALAR(_backward_npi_rcopysign_scalar)
 .set_attr<FCompute>("FCompute<cpu>",
                     BinaryScalarOp::Backward<cpu, mshadow_op::rcopysign_grad>);
 
+MXNET_OPERATOR_REGISTER_NP_BINARY_SCALAR(_npi_left_shift_scalar)
+.set_attr<FCompute>("FCompute<cpu>", BitScalarCompute<cpu, mshadow_op::left_shift>)
+.set_attr<nnvm::FGradient>("FGradient", MakeZeroGradNodes);
 
 Review comment:
   Why the gradient is zero? as operator described, this operation is equivalent to multiplying x1 by 2**x2. So it should have same gradient as multiplying by 2.

----------------------------------------------------------------
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