fn
repeat
→Tensorrepeat(x: Tensor, repeats: _int, dim: _int | None = None)Tile a tensor along an existing dimension.
Replicates input as a whole block repeats times along dim.
Contrast with repeat_interleave, which replicates each element
individually ([1, 1, 2, 2] vs. [1, 2, 1, 2]).
Parameters
xTensorSource tensor.
repeatsintNumber of block repetitions.
dimint= NoneDimension along which to repeat.
None flattens first.Returns
TensorNewly-allocated tensor — repeating always copies.
Notes
For multi-dim tiling patterns use tile, which accepts a
per-axis repetition vector.
Examples
>>> import lucid
>>> x = lucid.tensor([1, 2, 3])
>>> lucid.repeat(x, 2, dim=0)
Tensor([1, 2, 3, 1, 2, 3])