Esempio n. 1
0
 def test_script(self):
     net = VNet(spatial_dims=3,
                in_channels=1,
                out_channels=3,
                dropout_dim=3)
     test_data = torch.randn(1, 1, 32, 32, 32)
     test_script_save(net, test_data)
Esempio n. 2
0
 def test_script(self):
     net = VNet(spatial_dims=3,
                in_channels=1,
                out_channels=3,
                dropout_dim=3)
     test_data = torch.randn(1, 1, 32, 32, 32)
     out_orig, out_reloaded = test_script_save(net, test_data)
     assert torch.allclose(out_orig, out_reloaded)
Esempio n. 3
0
 def test_vnet_shape(self, input_param, input_data, expected_shape):
     net = VNet(**input_param)
     net.eval()
     with torch.no_grad():
         result = net.forward(input_data)
         self.assertEqual(result.shape, expected_shape)
Esempio n. 4
0
 def test_vnet_shape(self, input_param, input_shape, expected_shape):
     net = VNet(**input_param).to(device)
     with eval_mode(net):
         result = net.forward(torch.randn(input_shape).to(device))
         self.assertEqual(result.shape, expected_shape)