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/01 12:05:16 UTC
[GitHub] [incubator-singa] joddiy commented on a change in pull request
#485: SINGA -475 add Sub operator implementation to singa
joddiy commented on a change in pull request #485: SINGA -475 add Sub operator implementation to singa
URL: https://github.com/apache/incubator-singa/pull/485#discussion_r309661987
##########
File path: test/python/test_operation.py
##########
@@ -322,6 +322,21 @@ def test_LeakyRelu(self):
np.testing.assert_array_almost_equal(tensor.to_numpy(result), XT)
self.check_shape(dx.shape(), (3, 2))
+ def test_Sub(self):
+ X=np.array([0.8,-1.2,3.3,-3.6,-0.5,0.5]).reshape(3,2).astype(np.float32)
+ Y=np.array([4.4,5.3,3.2,3.7,5.4,6.3]).reshape(3,2).astype(np.float32)
+ x = tensor.from_numpy(X)
+ y = tensor.from_numpy(Y)
+ x.to_device(gpu_dev)
+ y.to_device(gpu_dev)
+
+ result=autograd.sub(x,y)
+ dx=result.creator.backward(x.data)[0]
+
+ result_np=np.subtract(X,Y)
+ np.testing.assert_array_almost_equal(tensor.to_numpy(result), result_np)
Review comment:
please add the test case of backward propagation.
----------------------------------------------------------------
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