I had the same error after upgrading CUDA to version 10.1
I went to pytorch site and selected the installation preferences, for which in my case I got the following command:
conda install pytorch torchvision cudatoolkit=10.0 -c pytorch
Upon running the command, it turned out there were some inconsistencies among the previously installed libraries, but the installation (upgrade) went smooth and now everything works well.