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

[Docathon][Add API Legend No.2] #6941

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

Conversation

Liyulingyue
Copy link
Contributor

Copy link

paddle-bot bot commented Nov 10, 2024

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

@luotao1 luotao1 added the HappyOpenSource 快乐开源活动issue与PR label Nov 13, 2024
@@ -13,6 +13,12 @@ broadcast_tensors

.. _Tensor 介绍: ../../guides/beginner/tensor_cn.html#id7

下图展示将三个 Tensor 广播到同一维度的过程。三个 Tensor 的尺寸分别为 [4, 1, 3]、[2, 3]、[4, 2, 1],在广播时,会从最后一个维度开始对齐,对于每一个维度,任意两个 Tensor 的在该维度大小相等;或者其中一个 Tensor 的维度等于 1;或者其中一个 Tensor 的维度不存在。在下图中,最后一个维度中,Tenser3 取值为 1,Tensor1 和 Tensor2 取值为 3,所有 Tensor 的该维度被扩张为3;倒数第二个维度中,Tenser1 取值为 2,Tensor2 和 Tensor3 取值为 2,所有 Tensor 的该维度被扩张为2;倒数第三个维度中,Tenser2 为空,Tensor1 和 Tensor3 取值为 4,所有 Tensor 的该维度被扩张为4。最终,所有 Tensor 都被扩张到 [4, 2, 3]。
Copy link
Collaborator

Choose a reason for hiding this comment

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

文字可以稍微精简一下,可以直接说原shape是多少,广播后都成了多少,具某一维度的例子,具体细节参考 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.

其实,这段文字主要想表述,他们从后往前对齐,所以再删可能表达不清楚了。

Copy link
Collaborator

Choose a reason for hiding this comment

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

张师傅怎么回事,tensor的图例是不是画错了? 广播后应该不会新增数据呀
image

Copy link
Contributor Author

Choose a reason for hiding this comment

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

会增加,会复制一份的。

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
contributor HappyOpenSource 快乐开源活动issue与PR
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants