Hi @Vasiliy_Kuznetsov: thank you for taking the time to create the toy example.
The approach to save state_dict and reload the state_dict with the same architecture as you described would work as expected, and I don’t have issue with that.
To clarify, my purpose is to have: trained pytorch model (M) -> quantized trained pytorch model(M1) -> port to run on ARM cortex-M4 with CMSIS-NN (M3).
In order to do so, I am doing the intermediate steps:
quantized trained pytorch model(M2) -> export weights param in integers -> load to a brand new Pytorch architecture without quantized info(M2_int) -> this model will be close to what is developed in embedded device (M3).
I will update your example to show the above steps. What I am not clear is some normalization steps done in pytorch internal functions, that would be different between quantized and non-quantized model.