How to get the vector (extract the feature) of a transfered learned network?

Thanks for the response. The error I had raises from not having this line that I added:

model_conv = model_conv.cuda()

from PIL import Image
scaler = transforms.Scale((224, 224))
normalize = transforms.Normalize(mean=[0.485, 0.456, 0.406], std=[0.229, 0.224, 0.225])
to_tensor = transforms.ToTensor()
img = Image.open('mona.jpg')
image = normalize(to_tensor(scaler(img))).unsqueeze(0).to(device)
print(image.shape)
model_conv = model_conv.cuda()
tf_last_layer_chopped = nn.Sequential(*list(model_conv.children())[:-1])
output = tf_last_layer_chopped(image)
print(output)

There is a discussion in this page about the error I got.