def device_count() -> int:
    r"""Returns the number of XPUs device available."""
    if hasattr(intel_extension_for_pytorch._C, "_getDeviceCount"):
        if is_initialized():
            return intel_extension_for_pytorch._C._getDeviceCount()
        else:
            return intel_extension_for_pytorch._C._prefetchDeviceCount()
    else:
        return 0
Returns the number of XPUs device available.
intel_extension_for_pytorch/xpu/__init__.py