singa-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From GitBox <...@apache.org>
Subject [GitHub] [incubator-singa] nudles commented on a change in pull request #480: SINGA-474 ELU operator
Date Mon, 29 Jul 2019 01:38:41 GMT
nudles commented on a change in pull request #480: SINGA-474 ELU operator
URL: https://github.com/apache/incubator-singa/pull/480#discussion_r308031777
 
 

 ##########
 File path: python/singa/autograd.py
 ##########
 @@ -358,6 +358,37 @@ def relu(x):
     return ReLU()(x)[0]
 
 
+class Elu(Operation):
+    def __init__(self,alpha=1):
+        super(Elu, self).__init__()
+        self.alpha=alpha
+
+    def forward(self, x):
+        #f(x) = alpha * (exp(x) - 1.) for x < 0, f(x) = x for x >= 0
+        if training:
+            self.input = x
+        x1 = singa.LTFloat(x, 0.0)
+        x1 = singa.__mul__(x, x1)
+        x1 = singa.MultFloat(singa.SubFloat(singa.Exp(x1),self.alpha),1)
 
 Review comment:
   this line is computing (exp(x)-alpha) * 1?

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

Mime
View raw message