Hi,
This happens because you try to use cuda. By doing cnn.cuda() but you installed a cpu-only version of pytorch.
You should either remove the calls to .cuda() or install a cuda enabled version of pytorch.