Problems loading a custom LSTM Module (torch 1.4.0)

I’m facing problems loading a custom LSTM Module. The model works as expected during the training phase, but when I save the model and load it back, I get very different and very inaccurate results.

I have also verified the weights of all the layers of the model before and after loading, and they are exactly similar, but the results are significantly inaccurate after loading.

I have tried all the methods described in the official doc (
None of the methods seem to work.

Can someone please help me regarding the issue.


Could you post an executable code snippet to reproduce this error, please?