Difference between Pytorch version 0.2 and 1.7?

I am trying to transform a code written in PyTorch 0.2 to PyTorch version 1.7.
Somehow I managed to run the code in PyTorch 1.7 but the results are different from the original code.
I believe the loss computed in these two versions is different.

The link of the code is written in PyTorch 0.2:

Can anyone suggest changes in gen_step() and dis_step() in the base_model.py file in order to transform it to 1.7?