Rate this Page

torch.accelerator.device_count#

torch.accelerator.device_count()[source]#

Return the number of currentaccelerator available.

Returns

the number of the currentaccelerator available.

If there is no available accelerators, return 0.

Return type

int

Note

This API delegates to the device-specific version ofdevice_count.On CUDA, this API will NOT poison fork if NVML discovery succeeds.Otherwise, it will. For more details, seePoison fork in multiprocessing.