mindspore.numpy.broadcast_arrays

mindspore.numpy.broadcast_arrays(*args)[源代码]

Broadcasts any number of arrays against each other.

说明

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

参数

*args (Tensor) – The arrays to broadcast.

返回

List of Tensor.

异常

ValueError – If arrays cannot be broadcast.

Supported Platforms:

Ascend GPU CPU

示例

>>> 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]])]