diff --git a/monai/networks/nets/densenet.py b/monai/networks/nets/densenet.py index 40924cbc9ad..d8223303475 100644 --- a/monai/networks/nets/densenet.py +++ b/monai/networks/nets/densenet.py @@ -296,6 +296,9 @@ class DenseNet121(DenseNet): def __init__( self, + spatial_dims: int, + in_channels: int, + out_channels: int, init_features: int = 64, growth_rate: int = 32, block_config: Sequence[int] = (6, 12, 24, 16), @@ -303,9 +306,17 @@ def __init__( progress: bool = True, **kwargs, ) -> None: - super().__init__(init_features=init_features, growth_rate=growth_rate, block_config=block_config, **kwargs) + super().__init__( + spatial_dims=spatial_dims, + in_channels=in_channels, + out_channels=out_channels, + init_features=init_features, + growth_rate=growth_rate, + block_config=block_config, + **kwargs, + ) if pretrained: - if kwargs["spatial_dims"] > 2: + if spatial_dims > 2: raise NotImplementedError( "Parameter `spatial_dims` is > 2 ; currently PyTorch Hub does not" "provide pretrained models for more than two spatial dimensions." @@ -318,6 +329,9 @@ class DenseNet169(DenseNet): def __init__( self, + spatial_dims: int, + in_channels: int, + out_channels: int, init_features: int = 64, growth_rate: int = 32, block_config: Sequence[int] = (6, 12, 32, 32), @@ -325,9 +339,17 @@ def __init__( progress: bool = True, **kwargs, ) -> None: - super().__init__(init_features=init_features, growth_rate=growth_rate, block_config=block_config, **kwargs) + super().__init__( + spatial_dims=spatial_dims, + in_channels=in_channels, + out_channels=out_channels, + init_features=init_features, + growth_rate=growth_rate, + block_config=block_config, + **kwargs, + ) if pretrained: - if kwargs["spatial_dims"] > 2: + if spatial_dims > 2: raise NotImplementedError( "Parameter `spatial_dims` is > 2 ; currently PyTorch Hub does not" "provide pretrained models for more than two spatial dimensions." @@ -340,6 +362,9 @@ class DenseNet201(DenseNet): def __init__( self, + spatial_dims: int, + in_channels: int, + out_channels: int, init_features: int = 64, growth_rate: int = 32, block_config: Sequence[int] = (6, 12, 48, 32), @@ -347,9 +372,17 @@ def __init__( progress: bool = True, **kwargs, ) -> None: - super().__init__(init_features=init_features, growth_rate=growth_rate, block_config=block_config, **kwargs) + super().__init__( + spatial_dims=spatial_dims, + in_channels=in_channels, + out_channels=out_channels, + init_features=init_features, + growth_rate=growth_rate, + block_config=block_config, + **kwargs, + ) if pretrained: - if kwargs["spatial_dims"] > 2: + if spatial_dims > 2: raise NotImplementedError( "Parameter `spatial_dims` is > 2 ; currently PyTorch Hub does not" "provide pretrained models for more than two spatial dimensions." @@ -362,6 +395,9 @@ class DenseNet264(DenseNet): def __init__( self, + spatial_dims: int, + in_channels: int, + out_channels: int, init_features: int = 64, growth_rate: int = 32, block_config: Sequence[int] = (6, 12, 64, 48), @@ -369,7 +405,15 @@ def __init__( progress: bool = True, **kwargs, ) -> None: - super().__init__(init_features=init_features, growth_rate=growth_rate, block_config=block_config, **kwargs) + super().__init__( + spatial_dims=spatial_dims, + in_channels=in_channels, + out_channels=out_channels, + init_features=init_features, + growth_rate=growth_rate, + block_config=block_config, + **kwargs, + ) if pretrained: raise NotImplementedError("Currently PyTorch Hub does not provide densenet264 pretrained models.")