mindspore.numpy.broadcast_arrays
- mindspore.numpy.broadcast_arrays(*args)[源代码]
- 将任意数量的数组广播到共同的shape。 - 说明 - 不支持Numpy的 - subok参数。在图模式下,返回的不是Tensor列表,而是Tensor的tuple。- 参数:
- *args (Tensor) - 要进行广播的数组。 
 
- 返回:
- Tensor列表。 
- 异常:
- ValueError - 如果数组不能被广播。 
 
- 支持平台:
- 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]])]