Your code shouldn’t work, as you are trying to assign an int as a child module.
Anyway, changing the out_features won’t have any effect after the layer was initialized:
model = models.resnet50().eval()
x = torch.randn(1, 3, 224, 224)

out1 = model(x)

model.fc.out_features = 1

out2 = model(x)

print(out1.shape, out2.shape)
> torch.Size([1, 1000]) torch.Size([1, 1000])
print((out1 == out2).all())
> tensor(True)