Skip to content
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

Fix constructors for DenseNet derived classes #5846

Merged
merged 5 commits into from
Jan 14, 2023
Merged

Conversation

pzaffino
Copy link
Contributor

@pzaffino pzaffino commented Jan 12, 2023

Description

We noted it was possible to instantiate classes derived from DenseNet only if spatial_dims, in_channels, and out_channels parameters were passed by keywords.
Passing them via positional scheme was not working.
This small bug should be fixed now.

Example:

Before my fix:

import monai
net = monai.networks.nets.DenseNet(3,1,2) # Working
net = monai.networks.nets.DenseNet121(3,1,2) # NOT woking
net = monai.networks.nets.DenseNet121(spatial_dims=3, in_channels=1, out_channels=2) # Woking

After my fix:

import monai
net = monai.networks.nets.DenseNet121(3,1,2) # Woking

Thanks to @robsver for pointing this issue out.

Types of changes

  • Non-breaking change (fix or new feature that would not break existing functionality).
  • Breaking change (fix or new feature that would cause existing functionality to change).
  • New tests added to cover the changes.
  • Integration tests passed locally by running ./runtests.sh -f -u --net --coverage.
  • Quick tests passed locally by running ./runtests.sh --quick --unittests --disttests.
  • In-line docstrings updated.
  • Documentation updated, tested make html command in the docs/ folder.

monai/networks/nets/densenet.py Outdated Show resolved Hide resolved
monai/networks/nets/densenet.py Outdated Show resolved Hide resolved
Signed-off-by:  831580+wyli@users.noreply.github.com

Signed-off-by: Wenqi Li <831580+wyli@users.noreply.github.com>
@wyli
Copy link
Member

wyli commented Jan 14, 2023

/black

Signed-off-by: monai-bot <monai.miccai2019@gmail.com>
@pzaffino
Copy link
Contributor Author

Thank you @wyli !

@wyli
Copy link
Member

wyli commented Jan 14, 2023

/build

@wyli wyli enabled auto-merge (squash) January 14, 2023 22:32
@wyli wyli merged commit 6cb4ced into Project-MONAI:dev Jan 14, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants