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

Conversation

yangxiaoyu14
Copy link
Contributor

@yangxiaoyu14 yangxiaoyu14 commented Aug 24, 2023

Add dtensor from fn cn doc

PADDLEPADDLE_PR=56565

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

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

Choose a reason for hiding this comment

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

一般参数之间需要有个空格分割

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


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

通过传入的函数fn以及可能的参数*args,**kwargs构造一个tensor,将这个tensor传给shard_tensor
Copy link
Contributor

Choose a reason for hiding this comment

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

这个描述是API的实现过程,我们这里重点描述API的功能,比如:通过的paddle API(一般是Tensor创建类API)结合分布式属性创建一个带有分布式属性的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.

参考修改为:通过一个paddle API(一般是Tensor创建类的API)结合分布式属性dist_attr创建一个带有分布式属性的Tensor。

参数
:::::::::

- **fn** - 类似empty/ones/zeros等任意函数
Copy link
Contributor

Choose a reason for hiding this comment

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

先说是什么函数,再举例。比如:paddle公开的可创建Tensor的API。例如:paddle.emptypaddle.onespaddle.zeros等paddle API
这里的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.

修改完成,查找学习了rst文件插入外部链接的办法


- **fn** - 类似empty/ones/zeros等任意函数
- **dist_attr** (paddle.distributed.DistAttr) - 描述 Tensor 在 ProcessMesh 上的分布或切片方式。
- ***args** - fn函数可能存在的参数
Copy link
Contributor

Choose a reason for hiding this comment

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

“可能存在”有点奇怪,直接说fn函数的输入参数是不是就行,而且和下面的参数介绍要不要区分一下,fn函数的输入参数(Tuple形式),下面是Dict形式

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

Copy link
Collaborator

@sunzhongkai588 sunzhongkai588 left a comment

Choose a reason for hiding this comment

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

  • 中英文之间务必加空格,我没有全部标出来,请检查~
  • 在 PR描述里 可以加上相对应的英文文档PR PADDLEPADDLE_PR=<PR_NUMBER>,这样就可以预览代码示例了


.. 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

@@ -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

Comment on lines 13 to 16
- **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

Copy link
Collaborator

@sunzhongkai588 sunzhongkai588 left a comment

Choose a reason for hiding this comment

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

LGTM

@sunzhongkai588 sunzhongkai588 merged commit c576467 into PaddlePaddle:develop Sep 19, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants