tile¶
- paddle. tile ( x, repeat_times, name=None ) [source]
- 
         Construct a new Tensor by repeating xthe number of times given byrepeat_times. After tiling, the value of the i’th dimension of the output is equal tox.shape[i]*repeat_times[i].Both the number of dimensions of xand the number of elements inrepeat_timesshould be less than or equal to 6.- Parameters
- 
           - x (Tensor) – The input tensor, its data type should be bool, float32, float64, int32 or int64. 
- repeat_times (list|tuple|Tensor) – The number of repeating times. If repeat_times is a list or tuple, all its elements should be integers or 1-D Tensors with the data type int32. If repeat_times is a Tensor, it should be an 1-D Tensor with the data type int32. 
- name (str, optional) – Name for the operation (optional, default is None). For more information, please refer to Name. 
 
- Returns
- 
           N-D Tensor. The data type is the same as x. The size of the i-th dimension is equal tox[i] * repeat_times[i].
 Examples import paddle data = paddle.to_tensor([1, 2, 3], dtype='int32') out = paddle.tile(data, repeat_times=[2, 1]) print(out) # Tensor(shape=[2, 3], dtype=int32, place=Place(gpu:0), stop_gradient=True, # [[1, 2, 3], # [1, 2, 3]]) out = paddle.tile(data, repeat_times=(2, 2)) print(out) # Tensor(shape=[2, 6], dtype=int32, place=Place(gpu:0), stop_gradient=True, # [[1, 2, 3, 1, 2, 3], # [1, 2, 3, 1, 2, 3]]) repeat_times = paddle.to_tensor([1, 2], dtype='int32') out = paddle.tile(data, repeat_times=repeat_times) print(out) # Tensor(shape=[1, 6], dtype=int32, place=Place(gpu:0), stop_gradient=True, # [[1, 2, 3, 1, 2, 3]]) 
