Hi,
I’m trying to slice a network in the middle and then use a fc layer to extract the feature. So, I followed these steps:
model = nn.Sequential(*list(model.children())[:-5]) # to  slice the network
for param in model.parameters():    # freeze the network
param.requires_grad = False
class Flatten(nn.Module):     # Flatten
def init(self):
super(Flatten, self).init()
def forward(self,x):
x = x.view(x.size(0),-1)
return x
model_new = nn.Sequential(model, XXConv(64, 64, 16, 3, use_bias=False), Flatten(), nn.Linear(64+64, 10), nn.ReLU(), nn.Dropout(0.4))          #adding a conv and a fc layer
After these steps, when I am trying the network, I am getting the below error:
"forward() takes 2 positional arguments but 3 were given "
Any help would be appreciated.