Solved by David_Alford in post #3 
              
              
                PyTorch comes with a component called autograd  which provides automatic differentiation for all operations on Tensors, and Tensors which can remember where they “came from”. 
From the PyTorch docs: 

torch.Tensor  is the central class of the package. If you set its attribute  .requires_grad  as  Tr…