The blog doesn't verify if the code is actually using the GPU. The code will work perfectly fine on CPU, albeit slowly. You should run this to be sure:

    python -c "import torch; print(torch.cuda.is_available())"
Strange that torch.cuda.is_available() is used for AMD also.

Use rocm-smi to be double sure.