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

Method test_shape

tests/networks/test_varnet.py:36–45  ·  view source on GitHub ↗
(self, coil_sens_model, refinement_model, num_cascades, input_shape, expected_shape)

Source from the content-addressed store, hash-verified

34class TestVarNet(unittest.TestCase):
35 @parameterized.expand(TESTS)
36 def test_shape(self, coil_sens_model, refinement_model, num_cascades, input_shape, expected_shape):
37 net = VariationalNetworkModel(coil_sens_model, refinement_model, num_cascades).to(device)
38 mask_shape = [1 for _ in input_shape]
39 mask_shape[-2] = input_shape[-2]
40 mask = torch.zeros(mask_shape)
41 mask[..., mask_shape[-2] // 2 - 5 : mask_shape[-2] // 2 + 5, :] = 1
42
43 with eval_mode(net):
44 result = net(torch.randn(input_shape).to(device), mask.bool().to(device))
45 self.assertEqual(result.shape, expected_shape)
46
47 @parameterized.expand(TESTS)
48 def test_script(self, coil_sens_model, refinement_model, num_cascades, input_shape, expected_shape):

Callers

nothing calls this directly

Calls 2

eval_modeFunction · 0.90

Tested by

no test coverage detected