[Hardware][openvino] is_openvino --> current_platform.is_openvino (#9716)

This commit is contained in:
Mengqing Cao
2024-10-26 10:59:06 +00:00
committed by GitHub
parent 067e77f9a8
commit 5cbdccd151
10 changed files with 69 additions and 38 deletions
+4
View File
@@ -11,6 +11,7 @@ class PlatformEnum(enum.Enum):
XPU = enum.auto()
CPU = enum.auto()
NEURON = enum.auto()
OPENVINO = enum.auto()
UNSPECIFIED = enum.auto()
@@ -52,6 +53,9 @@ class Platform:
def is_neuron(self) -> bool:
return self._enum == PlatformEnum.NEURON
def is_openvino(self) -> bool:
return self._enum == PlatformEnum.OPENVINO
def is_cuda_alike(self) -> bool:
"""Stateless version of :func:`torch.cuda.is_available`."""
return self._enum in (PlatformEnum.CUDA, PlatformEnum.ROCM)