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:
  

      github.com
  

  
    cai-lw/KBGAN/blob/master/base_model.py 1


    import torch
import torch.nn as nn
import torch.nn.functional as nnf
from config import config
from torch.autograd import Variable
from torch.optim import Adam
from metrics import mrr_mr_hitk
from data_utils import batch_by_size
import logging


class BaseModule(nn.Module):
    def __init__(self):
        super(BaseModule, self).__init__()

    def score(self, src, rel, dst):
        raise NotImplementedError

    def dist(self, src, rel, dst):
        raise NotImplementedError



  This file has been truncated. show original

  

  
    
    
  

  


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