(self)
| 84 | self.assertTrue(any(not torch.allclose(sample, cutmix(sample)) for _ in range(10))) |
| 85 | |
| 86 | def test_cutmixd(self): |
| 87 | for dims in [2, 3]: |
| 88 | shape = (6, 3) + (32,) * dims |
| 89 | t = torch.rand(*shape, dtype=torch.float32) |
| 90 | label = torch.randint(0, 1, shape) |
| 91 | sample = {"a": t, "b": t, "lbl1": label, "lbl2": label} |
| 92 | cutmix = CutMixd(["a", "b"], 6, label_keys=("lbl1", "lbl2")) |
| 93 | cutmix.set_random_state(seed=123) |
| 94 | output = cutmix(sample) |
| 95 | # but mixing of labels is not affected by it |
| 96 | self.assertTrue(torch.allclose(output["lbl1"], output["lbl2"])) |
| 97 | |
| 98 | |
| 99 | class TestCutOut(unittest.TestCase): |
nothing calls this directly
no test coverage detected