Solved by alwynmathew in post #2 
              
              
                b = Variable(a)

In PyTorch 0.4.0 and above, Tensors and Variables have merged. This means that you don’t need the Variable wrapper everywhere in your code anymore. 
.data 
.data was the primary way to get the underlying Tensor from a Variable . After the merge of Tensors and Variables, calling y = …