torch.cpu.is_available

torch.cpu.is_available() [source]

Returns a bool indicating if CPU is currently available.

N.B. This function only exists to facilitate device-agnostic code

Return type

bool

© 2024, PyTorch Contributors
PyTorch has a BSD-style license, as found in the LICENSE file.
https://pytorch.org/docs/2.1/generated/torch.cpu.is_available.html