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.

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