Solved by albanD in post #4 
              
              
                If you use non-pytorch operations (like numpy) then the autograd engine will not work. 
If you really need these operations, you will have to create a custom autograd.Function for which you have to implement both the forward and the backward pass. In this, you will get Tensors that do not require gr…