This code works for me:
model_conv = torchvision.models.resnet18(pretrained=False)
num_ftrs = model_conv.fc.in_features
model_conv.fc = nn.Linear(num_ftrs, 7)
tf_last_layer_chopped = nn.Sequential(*list(model_conv.children())[:-1])
x = torch.randn(1, 3, 224, 224)
output = tf_last_layer_chopped(x)
print(output.shape)
> torch.Size([1, 512, 1, 1])

Could you check for differences between your code and this example?