Gradient flow after conversion from tensor to numpy

To use one function i need to convert pytorch tensor to numpy and want to back propagate gradient after calculating loss which is in numpy array. Is there any way to backpropagate error as i used the “detach” on tensor?

Autograd won’t be able to create the computation graph for the numpy opertations, so you would have to write a custom autograd.Function as described here and implement the backward method manually.