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

Method test_ema_shape

tests/networks/layers/test_vector_quantizer.py:30–41  ·  view source on GitHub ↗
(self, input_param, input_shape, output_shape)

Source from the content-addressed store, hash-verified

28class TestEMA(unittest.TestCase):
29 @parameterized.expand(TEST_CASES)
30 def test_ema_shape(self, input_param, input_shape, output_shape):
31 layer = EMAQuantizer(**input_param)
32 x = torch.randn(input_shape)
33 layer = layer.train()
34 outputs = layer(x)
35 self.assertEqual(outputs[0].shape, input_shape)
36 self.assertEqual(outputs[2].shape, output_shape)
37
38 layer = layer.eval()
39 outputs = layer(x)
40 self.assertEqual(outputs[0].shape, input_shape)
41 self.assertEqual(outputs[2].shape, output_shape)
42
43 @parameterized.expand(TEST_CASES)
44 def test_ema_quantize(self, input_param, input_shape, output_shape):

Callers

nothing calls this directly

Calls 2

EMAQuantizerClass · 0.90
trainMethod · 0.45

Tested by

no test coverage detected