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

Method test_tensor_input

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

Source from the content-addressed store, hash-verified

67 cp.testing.assert_allclose(result, test_data)
68
69 def test_tensor_input(self):
70 test_data = torch.tensor([[1, 2], [3, 4]], dtype=torch.float32)
71 test_data = test_data.rot90()
72 self.assertFalse(test_data.is_contiguous())
73 result = ToCupy()(test_data)
74 self.assertEqual(result.dtype, cp.float32)
75 self.assertIsInstance(result, cp.ndarray)
76 self.assertTrue(result.flags["C_CONTIGUOUS"])
77 cp.testing.assert_allclose(result, test_data)
78
79 @skip_if_no_cuda
80 def test_tensor_cuda_input(self):

Callers

nothing calls this directly

Calls 1

ToCupyClass · 0.90

Tested by

no test coverage detected