Error:torch.cuda.is_available() return true in cmd but return false in pycharm

You are most likely using different Python environments and the one used in PyTorch might have installed the CPU-only binary.
Also, according to this topic the user claimed os.environ["CUDA_VISIBLE_DEVICES"]='1' was set somehow in Pycharm without manually setting it, which was hiding the only available GPU.