MCPcopy Create free account
hub / github.com/Project-MONAI/MONAI / test_tensor_cuda_input

Method test_tensor_cuda_input

tests/transforms/test_to_numpy.py:58–65  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

56
57 @skip_if_no_cuda
58 def test_tensor_cuda_input(self):
59 test_data = torch.tensor([[1, 2], [3, 4]]).cuda()
60 test_data = test_data.rot90()
61 self.assertFalse(test_data.is_contiguous())
62 result = ToNumpy()(test_data)
63 self.assertIsInstance(result, np.ndarray)
64 self.assertTrue(result.flags["C_CONTIGUOUS"])
65 assert_allclose(result, test_data, type_test=False)
66
67 def test_list_tuple(self):
68 test_data = [[1, 2], [3, 4]]

Callers

nothing calls this directly

Calls 2

ToNumpyClass · 0.90
assert_allcloseFunction · 0.90

Tested by

no test coverage detected