Let us visualize it

image937×468 7.69 KB

What we need to understand is that in both the two dashes the architecture is very different. What the .cpu() command does is transfers the data into the memory linked to the x86 architecture which can then be leveraged by the numpy libraries. Numpy relies heavily on C which again is linked to the architecture of normal CPUs, hence the direct GPU Tensor to Numpy does not work