mindspore.hal.is_available
- mindspore.hal.is_available(device_target)[source]
Returns whether specified backend is available. All dependent libraries should be successfully loaded if this backend is available.
Note
The api will be deprecated.
CPU hardware, please use the interface
mindspore.device_context.cpu.is_available()
.GPU hardware, please use the interface
mindspore.device_context.gpu.is_available()
.Ascend hardware, please use the interface
mindspore.device_context.ascend.is_available()
.
- Parameters
device_target (str) – The device name of backend, should be one of "CPU", "GPU" and "Ascend".
- Returns
Bool, whether the specified backend is available for this MindSpore package.
Examples
>>> import mindspore as ms >>> device_target = ms.context.get_context("device_target") >>> print(ms.hal.is_available(device_target)) True