szha commented on a change in pull request #9662: Gluon PReLU, ELU, SELU, Swish URL: https://github.com/apache/incubator-mxnet/pull/9662#discussion_r165499599
########## File path: src/operator/leaky_relu-inl.h ########## @@ -177,9 +182,20 @@ class LeakyReLUOp : public Operator { case leakyrelu::kPReLU: { weight = in_data[leakyrelu::kGamma].get<xpu, 1, real_t>(s); grad_weight = in_grad[leakyrelu::kGamma].get<xpu, 1, real_t>(s); - grad_weight = sumall_except_dim<1>(F<prelu_grad>(data) * grad); - gdata = F<mshadow_op::xelu_grad>(data, mshadow::expr::broadcast<1>(weight, data.shape_)) - * grad; + if (weight.shape_[0] == 1) { Review comment: If the weight parameter is shared across all axis, then the only one scalar value is shared everywhere, in which case the weight should be (1,) ---------------------------------------------------------------- This is an automated message from the Apache Git Service. To respond to the message, please log on 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 With regards, Apache Git Services