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

Method test_cupy

tests/transforms/test_to_tensor.py:51–56  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

49
50 @unittest.skipUnless(HAS_CUPY, "CuPy is required.")
51 def test_cupy(self):
52 test_data = [[1, 2], [3, 4]]
53 cupy_array = cp.ascontiguousarray(cp.asarray(test_data))
54 result = ToTensor()(cupy_array)
55 self.assertTrue(isinstance(result, torch.Tensor))
56 assert_allclose(result, test_data, type_test=False)
57
58
59if __name__ == "__main__":

Callers

nothing calls this directly

Calls 2

ToTensorClass · 0.90
assert_allcloseFunction · 0.90

Tested by

no test coverage detected