The reason for requiring explicit .cpu()
is that CPU tensors and the converted numpy arrays share memory. If a .cpu()
is implicitly done, the operation will be different for CUDA and CPU tensors, and we wanted to be explicit to avoid bugs.
10 Likes