vadimkantorov:

device_count


On MacOSX (without CUDA support) it is
>>> import torch
>>> torch.cuda.is_available()
False
>>> torch.cuda.device_count()
0

either you can check it with CUDA_VISIBLE_DEVICES="":
CUDA_VISIBLE_DEVICES="" python -c "import torch; print(torch.cuda.is_available() + torch.cuda.device_count())"
0