mindspore.mint.repeat_interleave
- mindspore.mint.repeat_interleave(input, repeats, dim=None, *, output_size=None) Tensor [source]
Repeat elements of a tensor along an axis, like
mindspore.numpy.repeat()
.Warning
Only support on Atlas A2 training series.
- Parameters
input (Tensor) – The tensor to repeat values for. Must be of types: float16, float32, int8, uint8, int16, int32, or int64.
repeats (Union[int, tuple, list, Tensor]) – The number of times to repeat, must be positive.
dim (int, optional) – The dim along which to repeat, Default:
None
. If dims is None, the input Tensor will be flattened and the output will alse be flattened.
- Keyword Arguments
output_size (int, optional) – Total output size for the given axis (e.g. sum of repeats), Default:
None
.- Returns
One tensor with values repeated along the specified dim. If input has shape
and dim is i, the output will have shape . The output type will be the same as the type of input.
- Supported Platforms:
Ascend
Examples
>>> import mindspore >>> import numpy as np >>> from mindspore import Tensor, mint >>> input = Tensor(np.array([[0, 1, 2], [3, 4, 5]]), mindspore.int32) >>> output = mint.repeat_interleave(input, repeats=2, dim=0) >>> print(output) [[0 1 2] [0 1 2] [3 4 5] [3 4 5]]