repeat_interleave¶
- paddle. repeat_interleave ( x, repeats, axis=None, name=None ) [source]
- 
         Returns a new tensor which repeats the xtensor along dimensionaxisusing the entries inrepeatswhich is a int or a Tensor.- Parameters
- 
           - x (Tensor) – The input Tensor to be operated. The data of - xcan be one of float32, float64, int32, int64.
- repeats (Tensor or int) – The number of repetitions for each element. repeats is broadcasted to fit the shape of the given axis. 
- axis (int, optional) – The dimension in which we manipulate. Default: None, the output tensor is flatten. 
- name (str, optional) – The default value is None. Normally there is no need for user to set this property. For more information, please refer to Name. 
 
- Returns
- 
           A Tensor with same data type as x.
- Return type
- 
           Tensor 
 Examples import paddle x = paddle.to_tensor([[1, 2, 3], [4, 5, 6]]) repeats = paddle.to_tensor([3, 2, 1], dtype='int32') paddle.repeat_interleave(x, repeats, 1) # [[1, 1, 1, 2, 2, 3], # [4, 4, 4, 5, 5, 6]] paddle.repeat_interleave(x, 2, 0) # [[1, 2, 3], [1, 2, 3], [4, 5, 6], [4, 5, 6]] paddle.repeat_interleave(x, 2, None) # [1, 1, 2, 2, 3, 3, 4, 4, 5, 5, 6, 6] 
