It shouldn’t be necessary to convert the tensor to a numpy array and transform it back and I would avoid doing so.
If no tensors applied on the target tensor require gradients, the no_grad() block would also not be necessary.