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

Method test_tensor_input

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

Source from the content-addressed store, hash-verified

46 assert_allclose(result, test_data, type_test=False)
47
48 def test_tensor_input(self):
49 test_data = torch.tensor([[1, 2], [3, 4]])
50 test_data = test_data.rot90()
51 self.assertFalse(test_data.is_contiguous())
52 result = ToNumpy(dtype=torch.uint8)(test_data)
53 self.assertIsInstance(result, np.ndarray)
54 self.assertTrue(result.flags["C_CONTIGUOUS"])
55 assert_allclose(result, test_data, type_test=False)
56
57 @skip_if_no_cuda
58 def test_tensor_cuda_input(self):

Callers

nothing calls this directly

Calls 2

ToNumpyClass · 0.90
assert_allcloseFunction · 0.90

Tested by

no test coverage detected