Hi,
Let’s see what each method does:
1.tensor.detach(): creates a tensor that shares storage with  tensor  that does not require grad. You should use  detach()  when attempting to remove a tensor from a computation graph, and  clone  as a way to copy the tensor while still keeping the copy as a part of the computation graph it came from.
2.tensor.cpu(): moves the tensor back to memory accessible to the CPU.
3.tensor.numpy(): converts tensor to numpy array np.array.
So img_var.cpu().numpy() is not same as img_var.detach().cpu().numpy() because it will move tensor to cpu without creating a storage shared copy of it. And would result in error for next forward pass of your graph computation.