Hello
As u suggested I replaced code as follows
def tensor2var(self,tensors,requires_grad=True)
Some code…
With torch.no_grad():
var=torch.autograd.Variable(tensor)
And where this function is called there also I replaced volatile by requires_grad=True
And it worked.
Thank u so much …