(self, spatial_axis, img: torch.Tensor, track_meta: bool, device)
| 63 | |
| 64 | @parameterized.expand(TORCH_CASES) |
| 65 | def test_torch(self, spatial_axis, img: torch.Tensor, track_meta: bool, device): |
| 66 | set_track_meta(track_meta) |
| 67 | img = img.to(device) |
| 68 | init_param = {"keys": "image", "spatial_axis": spatial_axis} |
| 69 | xform = Flipd(**init_param) |
| 70 | call_param = {"data": {"image": img}} |
| 71 | res = xform(**call_param) # type: ignore |
| 72 | self.assertEqual(img.shape, res["image"].shape) |
| 73 | if track_meta: |
| 74 | test_resampler_lazy(xform, res, init_param, call_param, output_key="image") |
| 75 | self.assertIsInstance(res["image"], MetaTensor) |
| 76 | else: |
| 77 | self.assertNotIsInstance(res["image"], MetaTensor) |
| 78 | self.assertIsInstance(res["image"], torch.Tensor) |
| 79 | with self.assertRaisesRegex(ValueError, "MetaTensor"): |
| 80 | xform.inverse(res) |
| 81 | |
| 82 | @unittest.skipIf(not config.USE_META_DICT, "not using meta dict") |
| 83 | def test_meta_dict(self): |
nothing calls this directly
no test coverage detected