mindspore.hal.get_device_name

View Source On Gitee
mindspore.hal.get_device_name(device_id, device_target=None)[source]

Get specified device's name, this api will be deprecated and removed in future versions.

Note

This method always returns "CPU" for CPU device.

Parameters
  • device_id (int) – The device id of which the name will be returned.

  • device_target (str, optional) – The target device specified, should be one of "CPU" , "GPU" and "Ascend" . Default None , represents the current device set by context.

Returns

str

Examples

>>> import mindspore
>>> device_target = mindspore.context.get_context("device_target")
>>> print(mindspore.hal.get_device_name(0, device_target))