.cpu().detach().numpy() vs .data.cpu().numpy()

The end result is the same.
The second one is going to be imperceptibly faster because you don’t track the gradients for the cpu() op. But nothing else.

4 Likes