torch_repeat_interleave(self, repeats, dim =NULL, output_size =NULL)
Arguments
self: (Tensor) the input tensor.
repeats: (Tensor or int) The number of repetitions for each element. repeats is broadcasted to fit the shape of the given axis.
dim: (int, optional) The dimension along which to repeat values. By default, use the flattened input array, and return a flat output array.
output_size: (int, optional) – Total output size for the given axis ( e.g. sum of repeats). If given, it will avoid stream syncronization needed to calculate output shape of the tensor.
This is different from `torch_Tensor.repeat` but similar to `numpy.repeat`.
repeat_interleave(repeats) -> Tensor
If the repeats is tensor([n1, n2, n3, ...]), then the output will be tensor([0, 0, ..., 1, 1, ..., 2, 2, ..., ...]) where 0 appears n1 times, 1 appears n2 times, 2 appears n3 times, etc.