megengine.functional.tile

tile(inp, reps)[source]

Construct an array by repeating inp the number of times given by reps. If reps has length d, the result will have dimension of max(d, inp.ndim). It is required that d >= inp.dim. If inp.ndim < d, inp is promoted to be d-dimensional by prepending new axis.

Parameters
  • inp (Tensor) – input tensor.

  • reps (Iterable[int]) – The number of repetitions of inp along each axis.

Returns

output tensor.

Examples

>>> import numpy as np
>>> x = Tensor([[1, 2], [3, 4]], np.int32)
>>> F.tile(x, (2,1))
Tensor([[1 2]
 [3 4]
 [1 2]
 [3 4]], dtype=int32, device=xpux:0)