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

Method test_cupy_input

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

Source from the content-addressed store, hash-verified

27class TestToNumpy(unittest.TestCase):
28 @skipUnless(HAS_CUPY, "CuPy is required.")
29 def test_cupy_input(self):
30 test_data = cp.array([[1, 2], [3, 4]])
31 test_data = cp.rot90(test_data)
32 self.assertFalse(test_data.flags["C_CONTIGUOUS"])
33 result = ToNumpy()(test_data)
34 self.assertIsInstance(result, np.ndarray)
35 self.assertTrue(result.flags["C_CONTIGUOUS"])
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]])

Callers

nothing calls this directly

Calls 4

ToNumpyClass · 0.90
assert_allcloseFunction · 0.90
arrayMethod · 0.80
getMethod · 0.80

Tested by

no test coverage detected