singa-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From GitBox <...@apache.org>
Subject [GitHub] [singa] joddiy commented on issue #557: Broadcast cudnn test passing
Date Thu, 07 Nov 2019 04:54:22 GMT
joddiy commented on issue #557: Broadcast cudnn test passing
URL: https://github.com/apache/singa/pull/557#issuecomment-550752560
 
 
   Hi, shicong, please use this to test __mul__
   ```
   def test_tensor_add_api(self):
   
       def _run_test(s1, s2):
           x_0 = np.random.random(s1).astype(np.float32)
           y_0 = np.random.random(s2).astype(np.float32)
           x0 = tensor.Tensor(device=gpu_dev, data=x_0)
           y0 = tensor.Tensor(device=gpu_dev, data=y_0)
   
           z0 = tensor._call_singa_func(singa_api.__mul__, x0.data, y0.data)
   
           #print(s1,s2,tensor.to_numpy(z0).shape)
           np.testing.assert_array_almost_equal(tensor.to_numpy(z0), x_0+y_0)
           return
   
       # 2d
       _run_test([3, 4], [3, 4])
       # 3d
       _run_test([3, 4, 5], [3, 4, 5])
       # 4d
       _run_test([3, 4, 5, 6], [3, 4, 5, 6])
       # 3d vs 1d
       _run_test([3, 4, 5], [5])
       # 3d vs 2d
       _run_test([3, 4, 5], [4, 5])
       # 4d vs 2d
       _run_test([3, 4, 5, 6], [5, 6])
       # 4d vs 3d
       _run_test([3, 4, 5, 6], [4, 5, 6])
       # 4d vs 4d
       _run_test([1, 4, 1, 6], [3, 1, 5, 6])
   ```

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