Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add_dtensor_from_fn_cn_doc #6130

Merged
30 changes: 30 additions & 0 deletions docs/api/paddle/distributed/dtensor_from_fn_cn.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
.. _cn_api_distributed_dtensor_from_fn:
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

该 api_label 和路径对齐

Suggested change
.. _cn_api_distributed_dtensor_from_fn:
.. _cn_api_paddle_distributed_dtensor_from_fn:

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done


dtensor_from_fn
-------------------------------

.. py:class:: paddle.distributed.dtensor_from_fn(fn, dist_attr, *args, **kwargs)

通过一个paddle API(一般是Tensor创建类的API)结合分布式属性dist_attr创建一个带有分布式属性的Tensor。
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

中英文间需要保留空格,保证写作风格统一,也检查下其余的地方有没有类似的问题

Suggested change
通过一个paddle API(一般是Tensor创建类的API)结合分布式属性dist_attr创建一个带有分布式属性的Tensor
通过一个 paddle API(一般是 Tensor 创建类的 API)结合分布式属性 dist_attr 创建一个带有分布式属性的 Tensor

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done


参数
:::::::::

- **fn** - paddle公开的可创建Tensor的API。例如:`paddle.empty`_、`paddle.ones`_、`paddle.zeros`_等paddle API
.. _paddle.empty:https://github.com/PaddlePaddle/Paddle/blob/develop/python/paddle/tensor/creation.py
.. _paddle.ones:https://github.com/PaddlePaddle/Paddle/blob/develop/python/paddle/tensor/creation.py
.. _paddle.zeros:https://github.com/PaddlePaddle/Paddle/blob/develop/python/paddle/tensor/creation.py
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

既然是中文文档,引用的相关 API 文档也请用中文的,即

Suggested change
- **fn** - paddle公开的可创建Tensor的API。例如:`paddle.empty`_、`paddle.ones`_、`paddle.zeros`_等paddle API
.. _paddle.empty:https://github.com/PaddlePaddle/Paddle/blob/develop/python/paddle/tensor/creation.py
.. _paddle.ones:https://github.com/PaddlePaddle/Paddle/blob/develop/python/paddle/tensor/creation.py
.. _paddle.zeros:https://github.com/PaddlePaddle/Paddle/blob/develop/python/paddle/tensor/creation.py
- **fn** - paddle 公开的可创建 Tensor 的 API。例如: :ref:`cn_api_paddle_empty` 、 :ref:`cn_api_paddle_ones` 、:ref:`cn_api_paddle_zeros` 等 paddle API。

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done

- **dist_attr** (paddle.distributed.DistAttr) - 描述 Tensor 在 ProcessMesh 上的分布或切片方式。
- ***args** - fn函数的输入参数(Tuple形式)
- ****kwargs** - fn函数的输入参数(Dict形式)


返回
:::::::::
带有分布式信息的 Tensor



**代码示例**

COPY-FROM: paddle.distributed.dtensor_from_fn