(shape=None, dtype=None, device=None)
| 50 | class TestMetaTensor(unittest.TestCase): |
| 51 | @staticmethod |
| 52 | def get_im(shape=None, dtype=None, device=None): |
| 53 | if shape is None: |
| 54 | shape = (1, 10, 8) |
| 55 | affine = torch.randint(0, 10, (4, 4)) |
| 56 | meta = {"fname": rand_string()} |
| 57 | t = torch.rand(shape) |
| 58 | if dtype is not None: |
| 59 | t = t.to(dtype) |
| 60 | if device is not None: |
| 61 | t = t.to(device) |
| 62 | m = MetaTensor(t.clone(), affine, meta) |
| 63 | return m, t |
| 64 | |
| 65 | def check_ids(self, a, b, should_match): |
| 66 | comp = self.assertEqual if should_match else self.assertNotEqual |
no test coverage detected