So you meant var.detach().numpy() breaks the computational graph and we cannot compute the gradient correctly anymore by using torch.autograd.grad() . Is it correct?

It is correct. Because you convert the Tensor into a numpy array, we cannot track gradients anymore.