I have a trained ResNext model, with model.fc.in_features = 2048
. I want to remove the last fc classification layer and have just the 2048 feature vector.
Replacing the module.fc = nn.Identity()
solves this, but I was wondering how could I reduce this feature vector to eg. 512 without retraining?
Setting module.fc = nn.MaxPool1d(8, stride=8)
throws
RuntimeError: Expected 3-dimensional tensor, but got 2-dimensional tensor for argument #1 'self' (while checking arguments for max_pool1d)