Thanks for sharing the link i will try it but excuse me . what is the difference between save tensor and extract features as i tried
    def forward(self, x):
        x = self.forward_features(x)
        y=x[-1].cpu().numpy()
        with open('res.pkl', 'wb') as df_file:
             pickle.dump(y, file = df_file)
    return x

but i got the tensor for one image .  Does the code i wrote right ? and if it is. how can i got it for all images.