Skip to content

Commit

Permalink
solve problem in unittests (two files with the same name)
Browse files Browse the repository at this point in the history
  • Loading branch information
thibaultdvx committed Jul 22, 2024
1 parent 456431d commit 03ec7b9
Show file tree
Hide file tree
Showing 8 changed files with 5 additions and 14 deletions.
Empty file added tests/unittests/nn/__init__.py
Empty file.
Empty file.
13 changes: 2 additions & 11 deletions tests/unittests/nn/blocks/test_se.py
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand All @@ -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,
)
)
Original file line number Diff line number Diff line change
Expand Up @@ -12,23 +12,23 @@ 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)
out = layer(input_3d)
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)
out = layer(input_3d, skip_input=skip_input)
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)
Expand Down
Empty file.
Empty file.
Empty file.
Empty file.

0 comments on commit 03ec7b9

Please sign in to comment.