Exemplo 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)
Exemplo 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)
Exemplo 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)
Exemplo 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)