How to delete layer in pretrained model?

I was wondering why the output for these two code is different?
1)



resnet50 = models.resnet50(pretrained=True)
resnet50.fc = Identity()
resnet50.avgpool = Identity()
output = resnet50(torch.randn(1, 3, 224, 224))
print(output.shape)

output:
torch.Size([1, 100352])
and the model resent50 looks like:

resnet50_2 = models.resnet50(pretrained=True)
model = nn.Sequential(*list(resnet50_2.children())[:-2])
print(model(torch.randn(1, 3, 224, 224)).shape)

output:
torch.Size([1, 2048, 7, 7])
and the model looks like: