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