mindspore.hal.is_available
- mindspore.hal.is_available(device_target)[source]
- Return whether specified device is available, this api will be deprecated and removed in future versions, please use the api - mindspore.device_context.cpu.is_available(),- mindspore.device_context.gpu.is_available(),- mindspore.device_context.ascend.is_available()instead.- Parameters
- device_target (str) – The target device specified, should be one of - "CPU",- "GPU"and- "Ascend". Default- None, represents the current device set by context.
- Returns
- bool 
 - Examples - >>> import mindspore >>> device_target = mindspore.context.get_context("device_target") >>> print(mindspore.hal.is_available(device_target)) True