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

Method test_tensor_cuda_input

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

Source from the content-addressed store, hash-verified

78
79 @skip_if_no_cuda
80 def test_tensor_cuda_input(self):
81 test_data = torch.tensor([[1, 2], [3, 4]], dtype=torch.float32).cuda()
82 test_data = test_data.rot90()
83 self.assertFalse(test_data.is_contiguous())
84 result = ToCupy()(test_data)
85 self.assertEqual(result.dtype, cp.float32)
86 self.assertIsInstance(result, cp.ndarray)
87 self.assertTrue(result.flags["C_CONTIGUOUS"])
88 cp.testing.assert_allclose(result, test_data)
89
90 @skip_if_no_cuda
91 def test_tensor_cuda_input_dtype(self):

Callers

nothing calls this directly

Calls 1

ToCupyClass · 0.90

Tested by

no test coverage detected