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

Method test_transpose

test/python/test_tensor.py:221–235  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

219 self.assertEqual(np.sum(a - b), 0.)
220
221 def test_transpose(self):
222 a = np.array(
223 [1.1, 1.1, 1.1, 1.1, 1.4, 1.3, 1.1, 1.6, 1.1, 1.1, 1.1, 1.2])
224 a = np.reshape(a, (2, 3, 2))
225 ta = tensor.from_numpy(a)
226
227 A1 = np.transpose(a)
228 tA1 = tensor.transpose(ta)
229 TA1 = tensor.to_numpy(tA1)
230 A2 = np.transpose(a, [0, 2, 1])
231 tA2 = tensor.transpose(ta, [0, 2, 1])
232 TA2 = tensor.to_numpy(tA2)
233
234 np.testing.assert_array_almost_equal(TA1, A1)
235 np.testing.assert_array_almost_equal(TA2, A2)
236
237 @unittest.skipIf(not singa_api.USE_CUDA, 'CUDA is not enabled')
238 def test_gpu_6d_transpose(self,dev=gpu_dev):

Callers

nothing calls this directly

Calls 2

reshapeMethod · 0.45
transposeMethod · 0.45

Tested by

no test coverage detected