diff --git a/tests/unittests/nn/__init__.py b/tests/unittests/nn/__init__.py new file mode 100644 index 000000000..e69de29bb diff --git a/tests/unittests/nn/blocks/__init__.py b/tests/unittests/nn/blocks/__init__.py new file mode 100644 index 000000000..e69de29bb diff --git a/tests/unittests/nn/blocks/test_se.py b/tests/unittests/nn/blocks/test_se.py index b3c3a962a..2444bcc3a 100644 --- a/tests/unittests/nn/blocks/test_se.py +++ b/tests/unittests/nn/blocks/test_se.py @@ -15,7 +15,7 @@ def test_SE_Block(input_3d): assert out.shape == input_3d.shape -def test_ResBlock_SE(input_3d, helpers): +def test_ResBlock_SE(input_3d): from clinicadl.nn.blocks import ResBlock_SE layer = ResBlock_SE( @@ -25,18 +25,9 @@ def test_ResBlock_SE(input_3d, helpers): ratio_channel=4, ) out = layer(input_3d) - expected_out_shape = helpers.compute_conv_output_size( - in_size=input_3d.shape[-1], kernel_size=3, stride=1, padding=1 - ) - expected_out_shape = helpers.compute_conv_output_size( - in_size=expected_out_shape, kernel_size=3, stride=1, padding=1 - ) - assert out.shape == torch.Size( + assert out.shape[:2] == torch.Size( ( input_3d.shape[0], 2**3, - expected_out_shape, - expected_out_shape, - expected_out_shape, ) ) diff --git a/tests/unittests/nn/blocks/test_unet_blocks.py b/tests/unittests/nn/blocks/test_unet.py similarity index 85% rename from tests/unittests/nn/blocks/test_unet_blocks.py rename to tests/unittests/nn/blocks/test_unet.py index 681688b12..4e7170d77 100644 --- a/tests/unittests/nn/blocks/test_unet_blocks.py +++ b/tests/unittests/nn/blocks/test_unet.py @@ -12,7 +12,7 @@ def skip_input(): return torch.randn(2, 4, 10, 10, 10) -def test_UNetDown(input_3d, helpers): +def test_UNetDown(input_3d): from clinicadl.nn.blocks import UNetDown layer = UNetDown(in_size=input_3d.shape[1], out_size=8) @@ -20,7 +20,7 @@ def test_UNetDown(input_3d, helpers): assert out.shape[:2] == torch.Size((input_3d.shape[0], 8)) -def test_UNetUp(input_3d, skip_input, helpers): +def test_UNetUp(input_3d, skip_input): from clinicadl.nn.blocks import UNetUp layer = UNetUp(in_size=input_3d.shape[1] * 2, out_size=2) @@ -28,7 +28,7 @@ def test_UNetUp(input_3d, skip_input, helpers): assert out.shape[:2] == torch.Size((input_3d.shape[0], 2)) -def test_UNetFinalLayer(input_3d, skip_input, helpers): +def test_UNetFinalLayer(input_3d, skip_input): from clinicadl.nn.blocks import UNetFinalLayer layer = UNetFinalLayer(in_size=input_3d.shape[1] * 2, out_size=2) diff --git a/tests/unittests/nn/layers/__init__.py b/tests/unittests/nn/layers/__init__.py new file mode 100644 index 000000000..e69de29bb diff --git a/tests/unittests/nn/layers/factory/__init__.py b/tests/unittests/nn/layers/factory/__init__.py new file mode 100644 index 000000000..e69de29bb diff --git a/tests/unittests/nn/networks/__init__.py b/tests/unittests/nn/networks/__init__.py new file mode 100644 index 000000000..e69de29bb diff --git a/tests/unittests/nn/networks/factory/__init__.py b/tests/unittests/nn/networks/factory/__init__.py new file mode 100644 index 000000000..e69de29bb