def device_count(): """Returns the number of GPUs available.""" if is_available(): _lazy_init() return torch._C._cuda_getDeviceCount() else: return 0