a tiny cleanup for `scatter_add_()`
Closed this issue · 1 comments
amirhfarzaneh commented
Since you're doing in-place operation at line 42 of Centerloss.py. You don't need to re-assign it. So just:
counts.scatter_add_(0, label.long(), ones)
jxgu1016 commented
That's right that scatter_add_
is a in-place op but it also returns the tensor. At line 42 & 43, I use the two styles to show the difference. Anyway, thanks for pointing this out.