Hi @albanD. I’m still having trouble with the tensor.view command. I thought I had it. If I bring in the resnet-50 and pop off the last linear layer, that leaves the last layer as an adaptive average pooling layer. With batches of 10 images. I’m getting a tensor size of (10, 2048, 1, 1,). I understand the “10” means 10 images and the 2048 means 2048 features. If I want a feature set of 1000 flat features, how do I reshape this?
I tried the following:
CNNmodel = models.resnet50(pretrained = True)
for param in CNNmodel.parameters():
param.requires_grad = False
model_change = nn.Sequential(*list(CNNmodel.children())[:-1])
CNNmodel = nn.Sequential(*model_change)
CNNmodel = nn.view(-1, 1, 1000)
CNNmodel = CNNmodel.cuda()
CNNmodel
That gave an error that nn does not have a module ‘view’. Not sure how to add a flatten layer on this.