mindspore.ops.repeat_interleave
- mindspore.ops.repeat_interleave(x, repeats, dim=None)[source]
Repeat elements of a tensor along an axis, like numpy.repeat.
- Parameters
- Returns
One tensor with values repeated along the specified axis. If x has shape (s1, s2, …, sn) and axis is i, the output will have shape (s1, s2, …, si * repeats, …, sn). The output type will be the same as the type of x.
- Supported Platforms:
Ascend
GPU
CPU
Examples
>>> x = Tensor(np.array([[0, 1, 2], [3, 4, 5]]), mindspore.int32) >>> output = ops.repeat_interleave(x, repeats=2, dim=0) >>> print(output) [[0 1 2] [0 1 2] [3 4 5] [3 4 5]]