コード例 #1
0
ファイル: test_se_blocks.py プロジェクト: simhaonline/MONAI
 def test_ill_arg(self):
     with self.assertRaises(ValueError):
         ChannelSELayer(spatial_dims=1, in_channels=4, r=100)
コード例 #2
0
ファイル: test_se_blocks.py プロジェクト: simhaonline/MONAI
 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)
コード例 #3
0
ファイル: test_se_blocks.py プロジェクト: kate-sann5100/MONAI
 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)
コード例 #4
0
ファイル: test_se_blocks.py プロジェクト: kate-sann5100/MONAI
 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)
コード例 #5
0
ファイル: test_se_blocks.py プロジェクト: LucasFidon/MONAI
 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)