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

Method test_to_cuda

tests/data/meta_tensor/test_meta_tensor.py:145–160  ·  view source on GitHub ↗

Test `to`, `cpu` and `cuda`. For `to`, check args and kwargs.

(self, device, dtype)

Source from the content-addressed store, hash-verified

143 @parameterized.expand(TESTS)
144 @skip_if_no_cuda
145 def test_to_cuda(self, device, dtype):
146 """Test `to`, `cpu` and `cuda`. For `to`, check args and kwargs."""
147 orig, _ = self.get_im(device=device, dtype=dtype)
148 m = orig.clone()
149 m = m.to("cuda")
150 self.check(m, orig, ids=False, device="cuda")
151 m = m.cpu()
152 self.check(m, orig, ids=False, device="cpu")
153 m = m.cuda()
154 self.check(m, orig, ids=False, device="cuda")
155 m = m.to("cpu")
156 self.check(m, orig, ids=False, device="cpu")
157 m = m.to(device="cuda")
158 self.check(m, orig, ids=False, device="cuda")
159 m = m.to(device="cpu")
160 self.check(m, orig, ids=False, device="cpu")
161
162 @skip_if_no_cuda
163 def test_affine_device(self):

Callers

nothing calls this directly

Calls 3

get_imMethod · 0.95
checkMethod · 0.95
cloneMethod · 0.80

Tested by

no test coverage detected