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 2017/11/30 17:08:00 UTC

[GitHub] KayneWest opened a new issue #8898: PReLU in gluon

KayneWest opened a new issue #8898: PReLU in gluon
URL: https://github.com/apache/incubator-mxnet/issues/8898
 
 
       class PReLU(gluon.HybridBlock):
           def __init__(self, *args):
               super(PReLU, self).__init__(*args)
               with self.name_scope():
                   self.alpha = self.params.get('alpha', shape=(1,), init=mx.init.Zero())
                   self.act = gluon.nn.Activation(activation='relu')
   
           def hybrid_forward(self, F, x, *args, **kwargs):
               pos = self.act(x)
               neg = F.negative(self.alpha.data()) * self.act(F.negative(x))
               return pos + neg
   
   This custom block only works for non-hybridized models (error below), but would be nice to see this as a default activation option, something similar to this: "gluon.nn.Activation(activation='prelu')" - Is this in the plans going forward?
   
       AssertionError: Argument data must be Symbol instances, but got 
       [ 0.]
       <NDArray 1 @cpu(0)>
   

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


With regards,
Apache Git Services