MCPcopy Create free account
hub / github.com/apache/singa / test_gpu_6d_transpose

Method test_gpu_6d_transpose

test/python/test_tensor.py:238–256  ·  view source on GitHub ↗
(self,dev=gpu_dev)

Source from the content-addressed store, hash-verified

236
237 @unittest.skipIf(not singa_api.USE_CUDA, 'CUDA is not enabled')
238 def test_gpu_6d_transpose(self,dev=gpu_dev):
239 s0 = (2,3,4,5,6,7)
240 axes1=[5,4,3,2,1,0]
241 s1 = (2,7,6,5,4,3)
242 s2 = (2,4,3,5,7,6)
243 a = np.random.random(s1)
244
245 ta = tensor.from_numpy(a)
246 ta.to_device(dev)
247
248 ta = tensor.reshape(ta,s1)
249 ta = tensor.transpose(ta,axes1)
250 ta = tensor.reshape(ta,s2)
251
252 a = np.reshape(a,s1)
253 a = np.transpose(a,axes1)
254 a = np.reshape(a,s2)
255
256 np.testing.assert_array_almost_equal(tensor.to_numpy(ta), a)
257
258 def test_einsum(self):
259

Callers

nothing calls this directly

Calls 3

to_deviceMethod · 0.45
reshapeMethod · 0.45
transposeMethod · 0.45

Tested by

no test coverage detected