Same model after loading state dict is slow. Is it possible?

I tried some benchmarks on CPU.
I tested inference speed of one CNN model which can compute optical flow.
The inference speed I checked was 0.4 s with random init, but when I loaded the state dict then the speed became 2s. I don’t know why. This situation doesn’t occur if I used other models.
Does anyone know the reason?

Hi,

I would try to set flush denormal to True, see doc.
If that solves the issue, then the problem comes from the fact that your trained model contains very very small numbers that are badly handled by your cpu.

3 Likes

Great! It works. Thank you very much

It works for me as well! Thanks! Debug for a whole day, I thought my code was ghosted.