How do i change the input shape of a pytorch resnet50 model before training to 224, 224, 3 from 3, 224, 224

40 Views Asked by At

How do i change the input shape of the pytorch resnet50 model before training on my dataset

I faced an error when i converted the trained model to .tflite format to use in a flutter app, which basically wanted me to change the input tensor of my model to 1, 224, 224, 3 from 1, 3, 224, 224.

1

There are 1 best solutions below

2
Ivan On

Permute the axes of your tensor:

x = x.permute(0,3,1,2)