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

Method test_numpy_input

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

Source from the content-addressed store, hash-verified

36 assert_allclose(result, test_data.get(), type_test=False)
37
38 def test_numpy_input(self):
39 test_data = np.array([[1, 2], [3, 4]])
40 test_data = np.rot90(test_data)
41 self.assertFalse(test_data.flags["C_CONTIGUOUS"])
42 result = ToNumpy(dtype="float32")(test_data)
43 self.assertIsInstance(result, np.ndarray)
44 self.assertEqual(result.dtype, np.float32)
45 self.assertTrue(result.flags["C_CONTIGUOUS"])
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]])

Callers

nothing calls this directly

Calls 3

ToNumpyClass · 0.90
assert_allcloseFunction · 0.90
arrayMethod · 0.80

Tested by

no test coverage detected