Thanks for the reply @ptrblck. I created a new environment and installed PyTorch using
conda install pytorch==1.8.0 torchvision==0.9.0 torchaudio==0.8.0 cudatoolkit=11.1 -c pytorch -c conda-forge
But it still shows torch.cuda.is_available() as false and gives a warning.

Screenshot from 2021-11-03 15-57-531855×163 29 KB