You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@singa.apache.org by GitBox <gi...@apache.org> on 2019/08/07 14:57:20 UTC
[GitHub] [incubator-singa] chrishkchris commented on a change in pull
request #488: SINGA -475 add Sign operator to singa
chrishkchris 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_r311601386
##########
File path: python/singa/autograd.py
##########
@@ -1828,3 +1828,18 @@ def backward(self, dy):
def leakyrelu(x, a=0.01):
return LeakyRelu(a)(x)[0]
+
+
+class Sign(Operation):
+ def forward(self, a):
+ if training:
+ self.input = a
+ return singa.Sign(a)
+
+ def backward(self, dy):
+ dx = singa.MultFloat(dy, 0.0)
+ return dx
+
+
+def sign(a):
+ return Sign()(a)[0]
Review comment:
change a to x
def sign(x):
return Sign()(x)[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:
users@infra.apache.org
With regards,
Apache Git Services