Pytorch Tutorial Error--CUDA

I was running the CIFAR10 tutorial and when I got to the CUDA portion, both locally and on colab (with a GPU runtime) I get the following error:

RuntimeError: Input type (torch.FloatTensor) and weight type (torch.cuda.FloatTensor) should be the same or input should be a MKLDNN tensor and weight is a dense tensor

This was after I ran the commands in the tutorial:

net.to(device)
inputs, labels = data[0].to(device), data[1].to(device)

And my device was confired as cuda:0

I hate it when I figure out the answer after I post.

If it isn’t clear you need to set to .to(device) inside the training loop, not just once.