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

Method test_cupy_input

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

Source from the content-addressed store, hash-verified

27@skipUnless(HAS_CUPY, "CuPy is required.")
28class TestToCupy(unittest.TestCase):
29 def test_cupy_input(self):
30 test_data = cp.array([[1, 2], [3, 4]], dtype=cp.float32)
31 test_data = cp.rot90(test_data)
32 self.assertFalse(test_data.flags["C_CONTIGUOUS"])
33 result = ToCupy()(test_data)
34 self.assertTrue(result.dtype == cp.float32)
35 self.assertTrue(isinstance(result, cp.ndarray))
36 self.assertTrue(result.flags["C_CONTIGUOUS"])
37 cp.testing.assert_allclose(result, test_data)
38
39 def test_cupy_input_dtype(self):
40 test_data = cp.array([[1, 2], [3, 4]], dtype=cp.float32)

Callers

nothing calls this directly

Calls 2

ToCupyClass · 0.90
arrayMethod · 0.80

Tested by

no test coverage detected