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

[SCU][Docathon][Add API Legend No.36]为tensordot API添加图例 #6971

Open
wants to merge 3 commits into
base: develop
Choose a base branch
from

Conversation

yangrongxinuser
Copy link
Contributor

为tensordot API添加图例并修改tensordot_cn.rst
中文文档链接:docs/api/paddle/tensordot_cn.rst
@From00
@sunzhongkai588

Copy link

paddle-bot bot commented Nov 14, 2024

感谢你贡献飞桨文档,文档预览构建中,Docs-New 跑完后即可预览,预览链接:http://preview-pr-6971.paddle-docs-preview.paddlepaddle.org.cn/documentation/docs/zh/api/index_cn.html
预览工具的更多说明,请参考:飞桨文档预览工具

@luotao1 luotao1 added the HappyOpenSource Pro 进阶版快乐开源活动,更具挑战性的任务 label Nov 14, 2024
@CLAassistant
Copy link

CLAassistant commented Nov 17, 2024

CLA assistant check
All committers have signed the CLA.

@@ -5,7 +5,13 @@ tensordot

.. py:function:: paddle.tensordot(x, y, axes=2, name=None)

Tensor 缩并运算(Tensor Contraction),即沿着 axes 给定的多个轴对两个 Tensor 对应元素的乘积进行加和操作。
Tensor 缩并运算(Tensor Tensordot),即计算的是两个张量在某些轴上的乘积并求和。
Copy link
Collaborator

Choose a reason for hiding this comment

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

这句话不用改

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的结果
Copy link
Collaborator

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]

可以选择沿一个或多个轴进行点积操作,操作后返回的结果张量维度是 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
Copy link
Collaborator

Choose a reason for hiding this comment

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

为什么用的 concat?

Copy link
Collaborator

Choose a reason for hiding this comment

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

整个文档改完后注意预览效果,根据预览效果再修改

Copy link
Collaborator

Choose a reason for hiding this comment

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

  • 每个 tensor 标上轴 axis
  • 优化一下图以更加清晰

@yangrongxinuser
Copy link
Contributor Author

@From00
@sunzhongkai588

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
contributor HappyOpenSource Pro 进阶版快乐开源活动,更具挑战性的任务
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants