Ejemplo n.º 1
0
 def test_ill_arg(self):
     with self.assertRaises(ValueError):
         ChannelSELayer(spatial_dims=1, in_channels=4, r=100)
Ejemplo n.º 2
0
 def test_shape(self, input_param, input_data, expected_shape):
     net = ChannelSELayer(**input_param)
     net.eval()
     with torch.no_grad():
         result = net(input_data)
         self.assertEqual(result.shape, expected_shape)
Ejemplo n.º 3
0
 def test_shape(self, input_param, input_shape, expected_shape):
     net = ChannelSELayer(**input_param)
     with eval_mode(net):
         result = net(torch.randn(input_shape))
         self.assertEqual(result.shape, expected_shape)
Ejemplo n.º 4
0
 def test_script(self):
     input_param, input_shape, _ = TEST_CASES[0]
     net = ChannelSELayer(**input_param)
     test_data = torch.randn(input_shape)
     test_script_save(net, test_data)
Ejemplo n.º 5
0
 def test_script(self):
     input_param, input_shape, _ = TEST_CASES[0]
     net = ChannelSELayer(**input_param)
     test_data = torch.randn(input_shape)
     out_orig, out_reloaded = test_script_save(net, test_data)
     assert torch.allclose(out_orig, out_reloaded)