Hi,
Why are you using torch.randn? I am relatively new to pytorch.
Also these are the last layers of the pretrained model

image699×296 7.37 KB

and the layer that I want to add is senetmodel.fc=nn.Linear(256, 128)
But I think before adding this layer I should flatten the feat_extract(Conv2d-238) layer which I am unable to do.