-
Notifications
You must be signed in to change notification settings - Fork 838
[SCU][Docathon][Add API Legend No.36]为tensordot API添加图例 -part #6971
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
Conversation
感谢你贡献飞桨文档,文档预览构建中,Docs-New 跑完后即可预览,预览链接:http://preview-pr-6971.paddle-docs-preview.paddlepaddle.org.cn/documentation/docs/zh/api/index_cn.html |
docs/api/paddle/tensordot_cn.rst
Outdated
@@ -5,7 +5,13 @@ tensordot | |||
|
|||
.. py:function:: paddle.tensordot(x, y, axes=2, name=None) | |||
|
|||
Tensor 缩并运算(Tensor Contraction),即沿着 axes 给定的多个轴对两个 Tensor 对应元素的乘积进行加和操作。 | |||
Tensor 缩并运算(Tensor Tensordot),即计算的是两个张量在某些轴上的乘积并求和。 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
这句话不用改
docs/api/paddle/tensordot_cn.rst
Outdated
Tensor 缩并运算(Tensor Contraction),即沿着 axes 给定的多个轴对两个 Tensor 对应元素的乘积进行加和操作。 | ||
Tensor 缩并运算(Tensor Tensordot),即计算的是两个张量在某些轴上的乘积并求和。 | ||
可以选择沿一个或多个轴进行点积操作,操作后返回的结果张量维度是 A 和 B 上未参与点积的维度的并集。 | ||
图例中展示了一个shape = [2,2,2]的a张量,和shape = [2,3]的b张量,res为a,b两个张量沿着axis = 1轴做tensordot的结果 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
不是沿着 axis=1 轴
,参考 axes 的参数说明 axes 可以是一个非负整数。若输入的是一个整数 n,则表示对 x 的后 n 个轴和对 y 的前 n 个轴进行缩并运算
,是对 [2,2,2] 的最后一个轴和 [2,3] 的第一个轴进行缩并,最终取得 [2,2,3]
docs/api/paddle/tensordot_cn.rst
Outdated
可以选择沿一个或多个轴进行点积操作,操作后返回的结果张量维度是 A 和 B 上未参与点积的维度的并集。 | ||
图例中展示了一个shape = [2,2,2]的a张量,和shape = [2,3]的b张量,res为a,b两个张量沿着axis = 1轴做tensordot的结果 | ||
res = paddle.tensordot(x, y, axes = 1) | ||
.. image:: ../../images/api_legend/concat.png |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
为什么用的 concat?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
整个文档改完后注意预览效果,根据预览效果再修改
docs/images/api_legend/tensordot.png
Outdated
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
- 每个 tensor 标上轴 axis
- 优化一下图以更加清晰
辛苦老师看看还有什么问题 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
PR完成后看一下预览,没问题再request review
docs/images/api_legend/tensordot.png
Outdated
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
图例axis = 0 和 axis = 1 弄反了,最终结果 res 的维度也标错了。 比如像 b张量 shape = [2,3], axis=0 的时候为 2,那怎么会像图中有 4,5,4 三个元素呢
docs/api/paddle/tensordot_cn.rst
Outdated
可以选择沿一个或多个轴进行点积操作,操作后返回的结果张量维度是 A 和 B 上未参与点积的维度的并集。 | ||
图例中展示了一个 shape = [2,2,2]的 a 张量,和 shape = [2,3]的 b 张量 | ||
shape = [2,2,3]的 res 张量为 a,b 两个张量沿着 a 张量的最后一个轴和 b 张量的第一个轴进行缩并的结果 | ||
res = paddle.tensordot(x, y, axes = 1) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
可以选择沿一个或多个轴进行点积操作,操作后返回的结果张量维度是 A 和 B 上未参与点积的维度的并集。 | |
图例中展示了一个 shape = [2,2,2]的 a 张量,和 shape = [2,3]的 b 张量 | |
shape = [2,2,3]的 res 张量为 a,b 两个张量沿着 a 张量的最后一个轴和 b 张量的第一个轴进行缩并的结果 | |
res = paddle.tensordot(x, y, axes = 1) | |
**图解说明** | |
可以选择沿一个或多个轴进行点积操作,操作后返回的结果张量维度是 A 和 B 上未参与点积的维度的并集。 | |
图例中展示了一个 shape = [2,2,2]的 ``a`` 张量,和 shape = [2,3]的 ``b`` 张量。 | |
shape = [2,2,3]的 ``res`` 张量为 a,b 两个张量沿着 a 张量的最后一个轴和 b 张量的第一个轴进行缩并的结果(即参数 ``axes = 1`` 的情况) | |
操作后返回的结果张量维度是 A 和 B 上未参与点积的维度的并集
这个 A 和 B是啥?- 注意下标点符号和格式
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
为tensordot API添加图例并修改tensordot_cn.rst
中文文档链接:docs/api/paddle/tensordot_cn.rst
@From00
@sunzhongkai588