(self, spatial_axis, img: torch.Tensor, track_meta: bool, device)
| 62 | |
| 63 | @parameterized.expand(TORCH_CASES) |
| 64 | def test_torch(self, spatial_axis, img: torch.Tensor, track_meta: bool, device): |
| 65 | set_track_meta(track_meta) |
| 66 | img = img.to(device) |
| 67 | init_param = {"spatial_axis": spatial_axis} |
| 68 | xform = Flip(**init_param) |
| 69 | call_param = {"img": img} |
| 70 | res = xform(**call_param) # type: ignore[arg-type] |
| 71 | self.assertEqual(img.shape, res.shape) |
| 72 | if track_meta: |
| 73 | test_resampler_lazy(xform, res, init_param, call_param) |
| 74 | self.assertIsInstance(res, MetaTensor) |
| 75 | else: |
| 76 | self.assertNotIsInstance(res, MetaTensor) |
| 77 | self.assertIsInstance(res, torch.Tensor) |
| 78 | with self.assertRaisesRegex(ValueError, "MetaTensor"): |
| 79 | xform.inverse(res) |
| 80 | |
| 81 | |
| 82 | if __name__ == "__main__": |
nothing calls this directly
no test coverage detected