(self)
| 74 | |
| 75 | class TestCutMix(unittest.TestCase): |
| 76 | def test_cutmix(self): |
| 77 | for dims in [2, 3]: |
| 78 | shape = (6, 3) + (32,) * dims |
| 79 | sample = torch.rand(*shape, dtype=torch.float32) |
| 80 | cutmix = CutMix(6, 1.0) |
| 81 | cutmix.set_random_state(seed=0) |
| 82 | output = cutmix(sample) |
| 83 | self.assertEqual(output.shape, sample.shape) |
| 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]: |
nothing calls this directly
no test coverage detected