MCPcopy Create free account
hub / github.com/Project-MONAI/MONAI / test_cutmix

Method test_cutmix

tests/transforms/test_regularization.py:76–84  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

74
75class 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]:

Callers

nothing calls this directly

Calls 2

CutMixClass · 0.90
set_random_stateMethod · 0.45

Tested by

no test coverage detected