How to know input shape of loaded model(weights)?

I did several training with different input size [224,512,…].
In inference I want to know input shape of each loaded model(weights) to get more accurate result.
is it possible to know input shape of loaded(saved) model?

inference works with any shape but if I use exact input shape performance will be better. (in inference I don’t know which weights trained with which input shape)

There isn’t a way to check the used shapes during training if the model is able to accept variable input shapes. You could store the input shapes e.g. in the checkpoint along with the state_dict or store it as an attribute in the model code instead.

1 Like