Skip to content

Commit 1a163d7

Browse files
committed
Add CN doc for broadcast_tensors
1 parent 9d4078b commit 1a163d7

File tree

1 file changed

+33
-0
lines changed

1 file changed

+33
-0
lines changed
Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
.. _cn_api_paddle_tensor_broadcast_tensors:
2+
3+
broadcast_tensors
4+
-------------------------------
5+
6+
.. py:function:: paddle.broadcast_tensors(inputs, name=None)
7+
8+
根据Broadcast规范对一组输入 ``inputs`` 进行Broadcast操作
9+
输入应符合Broadcast规范
10+
11+
参数
12+
:::::::::
13+
- inputs (list(Tensor)|tuple(Tensor)) - 一组输入Tensor,数据类型为:bool、float32、float64、int32或int64。
14+
- name (str,可选) - 操作的名称(可选,默认值为None)。更多信息请参见 :ref:`api_guide_Name` 。
15+
16+
返回
17+
:::::::::
18+
``list(Tensor)`` ,一组Broadcast后的 ``Tensor``,其顺序与 ``input`` 一一对应。
19+
20+
代码示例
21+
:::::::::
22+
23+
.. code-block:: python
24+
25+
import paddle
26+
import numpy as np
27+
28+
x1 = paddle.to_tensor(np.random.random([1, 2, 3, 4]).astype('float32'))
29+
x2 = paddle.to_tensor(np.random.random([1, 2, 1, 4]).astype('float32'))
30+
x3 = paddle.to_tensor(np.random.random([1, 1, 3, 1]).astype('float32'))
31+
32+
out1, out2, out3 = paddle.broadcast_tensors(input=[x1, x2, x3])
33+
# out1, out2, out3: 分别对应x1, x2, x3 Broadcast的结果,其形状均为 [1,2,3,4]

0 commit comments

Comments
 (0)