mindspore.numpy.broadcast_arrays

mindspore.numpy.broadcast_arrays(*args)[source]

Broadcasts any number of arrays against each other.

Note

Numpy argument subok is not supported. In graph mode, returns a tuple of Tensor instead of a list of Tensor.

Parameters

*args (Tensor) – The arrays to broadcast.

Returns

List of Tensor.

Raises

ValueError – if arrays cannot be broadcast.

Supported Platforms:

Ascend GPU CPU

Example

>>> import mindspore.numpy as np
>>> x = np.array([[1,2,3]])
>>> y = np.array([[4],[5]])
>>> output = np.broadcast_arrays(x, y)
>>> print(output)
[Tensor(shape=[2, 3], dtype=Int32, value=
[[1, 2, 3],
[1, 2, 3]]), Tensor(shape=[2, 3], dtype=Int32, value=
[[4, 4, 4],
[5, 5, 5]])]