repeat

dragon.repeat(
  inputs,
  axis=None,
  repeats=1,
  **kwargs
)[source]

Repeat the elements along the given axis.

Examples:

x = dragon.constant([[1, 2], [3, 4]])

# A negative axis is the last-k axis
print(dragon.repeat(x, axis=1, repeats=2))  # [[1, 1, 2, 2], [3, 3, 4, 4]]
print(dragon.repeat(x, axis=-1, repeats=2))  # Equivalent

# If axis is None, repeat a flattened input
print(dragon.repeat(x, repeats=2))  # [1, 1, 2, 2, 3, 3, 4, 4]
Parameters:
  • inputs (dragon.Tensor) – The input tensor.
  • axis (int, optional) – The axis to repeat.
  • repeats (Union[int, dragon.Tensor], optional, default=1) – The repeat size.
Returns:

dragon.Tensor – The output tensor.