nudles commented on a change in pull request #488: SINGA -475 add Sign operator 
to singa
URL: https://github.com/apache/incubator-singa/pull/488#discussion_r312397599
 
 

 ##########
 File path: python/singa/autograd.py
 ##########
 @@ -1828,3 +1828,21 @@ def backward(self, dy):
 
 def leakyrelu(x, a=0.01):
     return LeakyRelu(a)(x)[0]
+
+
+class Sign(Operation):
+    def __init__(self):
+        super(Sign, self).__init__()
+
+    def forward(self, a):
+        if training:
+            self.input = a
+        return singa.Sign(a)
+
+    def backward(self, dy):
+        dx = singa.MultFloat(dy, 0.0)
 
 Review comment:
   the dx is always 0?

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


With regards,
Apache Git Services

Reply via email to