singa-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From GitBox <...@apache.org>
Subject [GitHub] [incubator-singa] joddiy commented on a change in pull request #496: SINGA-474 Mean operator
Date Mon, 05 Aug 2019 07:13:31 GMT
joddiy commented on a change in pull request #496: SINGA-474 Mean operator
URL: https://github.com/apache/incubator-singa/pull/496#discussion_r310463919
 
 

 ##########
 File path: test/python/test_operation.py
 ##########
 @@ -322,6 +335,48 @@ def test_LeakyRelu(self):
         np.testing.assert_array_almost_equal(tensor.to_numpy(result), XT)
         self.check_shape(dx.shape(), (3, 2))
 
+    def test_Mean_gpu(self):
+        x0 = np.array([-0.9, -0.3, -0.1, 0.1, 0.5, 0.9]).reshape(3, 2).astype(np.float32)
+        x1 = np.array([0, -0.3, 0, 0.1, 0, 0.9]).reshape(3, 2).astype(np.float32)
+        y = (x0+x1)/2
+        lossf =lambda x,y:np.sum((x+y)/2)
+        grad=eval_numerical_gradient(lossf,x0,x1)
+        grad1=eval_numerical_gradient(lossf,x1,x0)
 
 Review comment:
   you can write it here because it doesn't matter when you change the order of x0 and x1
for ADD function. But when you write DIV function, you can not just switch it, because 'x0/x1'
is different from '1x/x0' 

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