mindspore.numpy.broadcast_to
- mindspore.numpy.broadcast_to(array, shape)[source]
Broadcasts an array to a new shape.
- Parameters
- Returns
Tensor, original array broadcast to the given shape.
- Raises
ValueError – If array cannot be broadcast to shape.
- Supported Platforms:
Ascend
GPU
CPU
Examples
>>> 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]]