Thanks for the reply.
I just managed to fix the error by adding the following line in transform:
transforms.Resize(size=(112, 112))

Now my code works. I just wonder if the whole approach makes sense in extracting features using a pre-trained model. The use of register_forward_hook and creating handle, for instance.