mindspore/docs/api/api_python/hal/mindspore.hal.device_count.rst

16 lines
667 B
ReStructuredText
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

mindspore.hal.device_count
============================
.. py:function:: mindspore.hal.device_count(device_target=None)
查询目标设备的数量,此接口将在后续版本中废弃,请使用接口 :func:`mindspore.device_context.cpu.device_count`:func:`mindspore.device_context.gpu.device_count`:func:`mindspore.device_context.ascend.device_count` 代替。
.. note::
- 对于 ``"CPU"`` 设备固定返回1。
参数:
- **device_target** (str可选) - 目标设备,可选值为 ``"CPU"`` ``"GPU"`` 以及 ``"Ascend"`` 。默认 ``None``,表示当前已经设置的设备。
返回:
int