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
1 change: 1 addition & 0 deletions docs/api/api_label
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ paddle.distributed.get_group .. _api_paddle_distributed_get_group:
paddle.distributed.ReduceOp .. _api_paddle_distributed_ReduceOp:
paddle.distributed.DistAttr .. _api_distributed_DistAttr:
paddle.distributed.shard_tensor .. _api_distributed_shard_tensor:
paddle.distributed.dtensor_from_fn .. _api_distributed_dtensor_from_fn:
paddle.distributed.fleet.UserDefinedRoleMaker .. _api_paddle_distributed_fleet_UserDefinedRoleMaker:
paddle.distributed.fleet.Role .. _api_paddle_distributed_fleet_Role:
paddle.distributed.fleet.HybridCommunicateGroup .. _api_paddle_distributed_fleet_HybridCommunicateGroup:
Expand Down
28 changes: 28 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,28 @@
.. _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)
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


通过传入的函数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文件插入外部链接的办法

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

- ****kwargs** - fn函数可能存在的参数


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



**代码示例**

COPY-FROM: paddle.distributed.dtensor_from_fn