singa-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From GitBox <...@apache.org>
Subject [GitHub] [incubator-singa] chrishkchris commented on a change in pull request #488: SINGA -475 add Sign operator to singa
Date Wed, 07 Aug 2019 15:04:52 GMT
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_r311601992
 
 

 ##########
 File path: test/python/test_operation.py
 ##########
 @@ -610,6 +610,42 @@ def test_Atanh_gpu(self):
         np.testing.assert_array_almost_equal(tensor.to_numpy(result), XT, decimal=5)
         self.check_shape(dx.shape(), (3, 2))
 
+    def test_Sign_cpu(self):
+        X = np.array([0.8, -1.2, 3.3, -3.6, -0.5, 0.5]).reshape(3, 2).astype(np.float32)
+        XT = np.sign(X)
+        DY = np.ones((3, 2), dtype = np.float32)
+
+        x = tensor.from_numpy(X)
+        dy = tensor.from_numpy(DY)
+        x.to_device(cpu_dev)
+        dy.to_device(cpu_dev)
+
+        result = autograd.sign(x)
+        dx = result.creator.backward(dy.data)
+        #dx = [x/|x|]'
 
 Review comment:
   delete the comment line at 625:  
           #dx = [x/|x|]'

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