repeat

Graph.repeat(input, repeats, axis=None, *, name=None)

Repeats elements of a tensor.

Parameters
  • input (np.ndarray or Tensor) – The tensor whose elements you want to repeat.

  • repeats (int or list[int]) – The number of times to repeat each element. If you pass a single int or singleton list, that number of repetitions is applied to each element. Otherwise, you must pass a list with the same length as input along the specified axis (or the same total length as input if you omit axis).

  • axis (int, optional) – The axis along which you want to repeat elements. If you omit this value then the input is first flattened, and the repetitions applied to the flattened array.

  • name (str, optional) – The name of the node.

Returns

The repeated tensor. The result has the same shape as input except along axis, where its size is either the sum of repeats (if repeats is a list with at least two elements) or the product of the original size along axis with repeats (if repeats is a single int or singleton list). If axis is None then the output is 1D, with the sizes as described above applied to the flattened input tensor.

Return type

Tensor