Skip to content

Update test_models.py #940

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Oct 12, 2024
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 16 additions & 4 deletions tests/test_models.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,12 +29,11 @@ def get_sample(model_class):
smp.PSPNet,
smp.UnetPlusPlus,
smp.MAnet,
smp.UPerNet,
]:
sample = torch.ones([1, 3, 64, 64])
elif model_class == smp.PAN:
elif model_class == smp.PAN or model_class == smp.UPerNet:
sample = torch.ones([2, 3, 256, 256])
elif model_class == smp.DeepLabV3:
elif model_class == smp.DeepLabV3 or model_class == smp.DeepLabV3Plus:
sample = torch.ones([2, 3, 128, 128])
else:
raise ValueError("Not supported model class {}".format(model_class))
Expand Down Expand Up @@ -102,6 +101,8 @@ def test_forward(model_class, encoder_name, encoder_depth, **kwargs):
smp.UnetPlusPlus,
smp.MAnet,
smp.DeepLabV3,
smp.DeepLabV3Plus,
smp.UPerNet,
],
)
def test_forward_backward(model_class):
Expand All @@ -112,7 +113,18 @@ def test_forward_backward(model_class):

@pytest.mark.parametrize(
"model_class",
[smp.PAN, smp.FPN, smp.PSPNet, smp.Linknet, smp.Unet, smp.UnetPlusPlus, smp.MAnet],
[
smp.PAN,
smp.FPN,
smp.PSPNet,
smp.Linknet,
smp.Unet,
smp.UnetPlusPlus,
smp.MAnet,
smp.DeepLabV3,
smp.DeepLabV3Plus,
smp.UPerNet,
],
)
def test_aux_output(model_class):
model = model_class(
Expand Down