udacity/deep-learning-v2-pytorch

images Tensor needs to be moved to CPU (cifar10_cnn_exercise.ipynb)

bfeeny opened this issue · 1 comments

This has an error in the last part of the notebook Visualize Sample Test Results

If student has images Tensor on the GPU, then imshow(images[idx]) will fail with

TypeError: can't convert non-cpu tensor to numpy. Use Tensor.cpu() to copy the tensor to host memory first.

The solution notebook has it correct, it should be changed to imshow(images.cpu()[idx])

I just have a look and found that it is duplicate of #258
Also, a PR is already raised for this issue #226