Skip to content

ResNet class does not respect argument feed_forward=False #3314

@codingS3b

Description

@codingS3b

Describe the bug
The ResNet class has a parameter feed_forward which allows skipping of the final dense layer if I intepret that correctly. A respective layer is only created if the parameter is set to True (see here) but in the forward pass, there is no query for whether the layer actually exists see here.

To Reproduce

import torch
from monai.networks.nets.resnet import resnet50

x = torch.ones((1, 1, 64, 64, 64))
model_monai = resnet50(spatial_dims=x.ndim-2, n_input_channels=x.shape[1], feed_forward=False)
print(model_monai)

# throws an error
y = model_monai(x)

Expected behavior
The ResNet class should not throw an error if feed_forward=False.

Metadata

Metadata

Assignees

Labels

questionFurther information is requested

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions