That won’t work as you are detaching the computation graph by calling numpy operations.
Autograd won’t be able to keep record of these operations, so that you won’t be able to simply backpropagate.
If you need the numpy functions, you would need to implement your own backward function and it should work again. Have a look at this tutorial 310 for more information.
Basically you autograd will track all operations as long as you stay in PyTorch land. Could you check, if your numpy functions are available in PyTorch?