As I mentioned, I used this command:
conda install pytorch torchvision cudatoolkit=10.1 -c pytorch
to install pytorch
EDIT: I removed the local installation of cuda. I removed pytorch, torchvision and cudatoolkit. Then I did a clean install of pytorch using the above command and still the cuda is avaliable throws false. Any suggestions would be helpful