[GitHub] [incubator-singa] nudles commented on a change in pull request #508: SINGA-474 transpose operator
nudles commented on a change in pull request #508: SINGA-474 transpose operator URL: https://github.com/apache/incubator-singa/pull/508#discussion_r313763362 ## File path: test/python/test_operation.py ## @@ -992,18 +992,55 @@ def test_Sqrt_gpu(self): np.testing.assert_array_almost_equal(tensor.to_numpy(result), XT, decimal=5) np.testing.assert_array_almost_equal(tensor.to_numpy(tensor.from_raw_tensor(dx)), DX, decimal=5) + +def test_transpose_cpu(self): +x = np.array([0.1,-1.0,0.4,4.0,-0.9,9.0]).reshape(3,2,1).astype(np.float32) +y = x.transpose(1,2,0) +dy = np.ones(y.shape, dtype = np.float32) +grad = np.ones((3,2,1), dtype = np.float32) Review comment: what is grad? why not use numpy transpose to get grad from dy? 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
[GitHub] [incubator-singa] nudles commented on a change in pull request #508: SINGA-474 transpose operator
nudles commented on a change in pull request #508: SINGA-474 transpose operator URL: https://github.com/apache/incubator-singa/pull/508#discussion_r313763362 ## File path: test/python/test_operation.py ## @@ -992,18 +992,55 @@ def test_Sqrt_gpu(self): np.testing.assert_array_almost_equal(tensor.to_numpy(result), XT, decimal=5) np.testing.assert_array_almost_equal(tensor.to_numpy(tensor.from_raw_tensor(dx)), DX, decimal=5) + +def test_transpose_cpu(self): +x = np.array([0.1,-1.0,0.4,4.0,-0.9,9.0]).reshape(3,2,1).astype(np.float32) +y = x.transpose(1,2,0) +dy = np.ones(y.shape, dtype = np.float32) +grad = np.ones((3,2,1), dtype = np.float32) Review comment: what is grad? 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
[GitHub] [incubator-singa] nudles commented on a change in pull request #508: SINGA-474 transpose operator
nudles commented on a change in pull request #508: SINGA-474 transpose operator URL: https://github.com/apache/incubator-singa/pull/508#discussion_r313762539 ## File path: test/python/test_operation.py ## @@ -992,18 +992,55 @@ def test_Sqrt_gpu(self): np.testing.assert_array_almost_equal(tensor.to_numpy(result), XT, decimal=5) np.testing.assert_array_almost_equal(tensor.to_numpy(tensor.from_raw_tensor(dx)), DX, decimal=5) + +def test_transpose_cpu(self): +x = np.array([0.1,-1.0,0.4,4.0,-0.9,9.0]).reshape(3,2,1).astype(np.float32) +y = x.transpose(1,2,0) +dy = np.ones(y.shape, dtype = np.float32) +grad = np.ones((3,2,1), dtype = np.float32) Review comment: use np.random.rand 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