What is the difference between .cpu().detach().numpy()
and .data.cpu().numpy()
?
When should I used one of these over the other?
What is the difference between .cpu().detach().numpy()
and .data.cpu().numpy()
?
When should I used one of these over the other?
.data
is an old api and should not be used anymore.
So the first one is the right way to go.
How about .cpu().detach()
vs .detach().cpu()
?
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.
Thank you very much. That answers my question exactly.
BTW, I don’t know if it’s allowed or forbid. May I ask you to look at another question I post?