mindspore.numpy.broadcast_to
- mindspore.numpy.broadcast_to(array, shape)[源代码]
- 将数组广播到新shape。 - 参数:
- array (Tensor) - 要广播的数组。 
- shape (tuple) - 目标数组的shape。 
 
- 返回:
- Tensor,原始数组被广播到指定的shape。 
- 异常:
- ValueError - 如果数组不能被广播到指定shape。 
 
- 支持平台:
- Ascend- GPU- CPU
 - 样例: - >>> import mindspore.numpy as np >>> x = np.array([1, 2, 3]) >>> output = np.broadcast_to(x, (3, 3)) >>> print(output) [[1 2 3] [1 2 3] [1 2 3]]