Solved by shivammehta007 in post #2 
              
              
                Is this Variable function the torch.autograd.Variable which is deprecated? Your data and target need not be Trainable. Also just for future reference if you want any tensor to be trainable just set its required_grad attribute as True or simply a.required_grad_() assuming a is a torch tensor. 
I coul…