Skip to content

Commit

Permalink
[NPU] add cn doc for npu_places api, test=develop (PaddlePaddle#3947)
Browse files Browse the repository at this point in the history
* [NPU] add cn doc for npu_places api, test=develop

* fix, test=develop

* add require npu, test=develop

* add require npu, test=develop

* copy from eng api, test=develop
  • Loading branch information
qili93 authored Oct 27, 2021
1 parent bdf830e commit a3eb368
Showing 1 changed file with 32 additions and 0 deletions.
32 changes: 32 additions & 0 deletions docs/api/paddle/static/npu_places_cn.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
.. _cn_api_fluid_npu_places:

npu_places
-------------------------------

.. py:function:: paddle.static.npu_places(device_ids=None)
.. note::
多卡任务请先使用 FLAGS_selected_npus 环境变量设置可见的NPU设备。

该接口根据 ``device_ids`` 创建一个或多个 ``paddle.NPUPlace`` 对象,并返回所创建的对象列表。

如果 ``device_ids`` 为 ``None``,则首先检查 ``FLAGS_selected_npus`` 标志。
例如: ``FLAGS_selected_npus=0,1,2`` ,则返回的列表将为 ``[paddle.NPUPlace(0), paddle.NPUPlace(1), paddle.NPUPlace(2)]``。
如果未设置标志 ``FLAGS_selected_npus`` ,则返回所有可见的 NPU places。

如果 ``device_ids`` 不是 ``None``,它应该是使用的NPU设备ID的列表或元组。
例如: ``device_id=[0,1,2]`` ,返回的列表将是 ``[paddle.NPUPlace(0), paddle.NPUPlace(1), paddle.NPUPlace(2)]``。

参数
:::::::::
- **device_ids** (list(int)|tuple(int),可选) - NPU的设备ID列表或元组。默认值为 ``None``。

返回
:::::::::
list[paddle.NPUPlace],创建的 ``paddle.NPUPlace`` 列表。

代码示例
:::::::::
COPY-FROM: paddle.static.npu_places

0 comments on commit a3eb368

Please sign in to comment.