szha commented on a change in pull request #9662: Gluon PReLU, ELU, SELU, Swish
URL: https://github.com/apache/incubator-mxnet/pull/9662#discussion_r165807578
 
 

 ##########
 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:
   There are two options, either writing it in Gluon by defining hybrid_forward 
in python, or extending the leaky relu operator in C for better performance.

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

Reply via email to