본문 바로가기
딥러닝공부

can't convert CUDA tensor to numpy. Use Tensor.cpu() to copy the tensor to host memory first.

by 부자독개 2021. 6. 18.
반응형
Change

index = output.data.numpy().argmax()

to

index = output.cpu().data.numpy().argmax()

This means data is first moved to cpu and then converted to numpy array

 

반응형

댓글