- paddle. broadcast_tensors ( input, name=None )
This OP broadcast a list of tensors following broadcast semantics
If you want know more about broadcasting, please refer to user_guide_broadcasting.
input (list|tuple) –
inputis a Tensor list or Tensor tuple which is with data type bool, float16, float32, float64, int32, int64. All the Tensors in
inputmust have same data type. Currently we only support tensors with rank no greater than 5.
name (str, optional) – The default value is None. Normally there is no need for user to set this property. For more information, please refer to Name.
The list of broadcasted tensors following the same order as
- Return type
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]