Because this is one of the first results when googling this error:
for me, this happened after I compiled from source on my local machine, then tried to run my code on another machine (compute cluster) with a different GPU architecture and compute capability.
I am currently compiling pytorch again, this time with TORCH_CUDA_ARCH_LIST="3.5 5.2 6.0 6.1 7.0+PTX" TORCH_NVCC_FLAGS="-Xfatbin -compress-all" (taken from the Dockerfile) to include compute capabilities not present on the machine compiling pytorch. Fingers crossed that helps