Don't cache device_count if we haven't initialized CUDA yet by ezyang · Pull Request #122815 · pytorch/pytorch
Stack from ghstack (oldest at bottom): -> Don't cache device_count if we haven't initialized CUDA yet #122815 Before initializing CUDA, it can change by modifying CUDA_VISIBLE_DEVICES ...