DenseNet121 with optional pretrained support when `spatial_dims` is 2.
| 294 | |
| 295 | |
| 296 | class DenseNet121(DenseNet): |
| 297 | """DenseNet121 with optional pretrained support when `spatial_dims` is 2.""" |
| 298 | |
| 299 | def __init__( |
| 300 | self, |
| 301 | spatial_dims: int, |
| 302 | in_channels: int, |
| 303 | out_channels: int, |
| 304 | init_features: int = 64, |
| 305 | growth_rate: int = 32, |
| 306 | block_config: Sequence[int] = (6, 12, 24, 16), |
| 307 | pretrained: bool = False, |
| 308 | progress: bool = True, |
| 309 | **kwargs, |
| 310 | ) -> None: |
| 311 | super().__init__( |
| 312 | spatial_dims=spatial_dims, |
| 313 | in_channels=in_channels, |
| 314 | out_channels=out_channels, |
| 315 | init_features=init_features, |
| 316 | growth_rate=growth_rate, |
| 317 | block_config=block_config, |
| 318 | **kwargs, |
| 319 | ) |
| 320 | if pretrained: |
| 321 | if spatial_dims > 2: |
| 322 | raise NotImplementedError( |
| 323 | "Parameter `spatial_dims` is > 2 ; currently PyTorch Hub does not" |
| 324 | "provide pretrained models for more than two spatial dimensions." |
| 325 | ) |
| 326 | _load_state_dict(self, "densenet121", progress) |
| 327 | |
| 328 | |
| 329 | class DenseNet169(DenseNet): |
no outgoing calls
searching dependent graphs…