| 27 | @skipUnless(HAS_CUPY, "CuPy is required.") |
| 28 | class 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) |