I faced the same problem and later on figured out the pytorch version I installed does not match CUDA version on my machine. I installed newer version of pytorch and it worked.
CUDA version 9.2.88
pytorch 0.4.1