Thanks for the reply Yash…
But unfortunately, this doesn’t work too…
My modified code is :
vgg16_model=models.vgg16(pretrained=True)
vgg16_model_classifier=vgg16_model.classifier[:-1]
img_var=Variable(torch.from_numpy(data).unsqueeze(0)).float()

features_var=vgg16_model_classifier(img_var)

features=features_var.data
features=features.data.numpy()

print(features.shape)

Now it throws a size mismatch error…
Thanks…