broadcast_tensors¶
根据 Broadcast 规范对一组输入 input
进行 Broadcast 操作 输入应符合 Broadcast 规范
注解
如想了解更多 Broadcasting 内容,请参见 Tensor 介绍 .
参数¶
input (list(Tensor)|tuple(Tensor)) - 一组输入 Tensor,数据类型为:bool、float32、float64、complex64、complex128、int32 或 int64。所有的输入 Tensor 均需要满足 rank <= 5。
name (str,可选) - 具体用法请参见 Name,一般无需设置,默认值为 None。
返回¶
list(Tensor)
,一组 Broadcast 后的 Tensor
,其顺序与 input
一一对应。
代码示例¶
>>> import paddle
>>> x1 = paddle.rand([1, 2, 3, 4]).astype('float32')
>>> x2 = paddle.rand([1, 2, 1, 4]).astype('float32')
>>> x3 = paddle.rand([1, 1, 3, 1]).astype('float32')
>>> out1, out2, out3 = paddle.broadcast_tensors(input=[x1, x2, x3])
>>> # out1, out2, out3: tensors broadcasted from x1, x2, x3 with shape [1,2,3,4]