ttnn.repeat

ttnn.repeat(input_tensor: ttnn.Tensor, repetition_vector: SmallVector, *, memory_config: ttnn.MemoryConfig = None) ttnn.Tensor

Returns a new tensor filled with repetition of input input_tensor according to number of times specified in shape.

Parameters:
  • input_tensor (ttnn.Tensor) – the input tensor.

  • repetition_vector (SmallVector) – The number of repetitions for each dimension.

Keyword Arguments:

memory_config (ttnn.MemoryConfig, optional) – Memory configuration for the operation. Defaults to None.

Returns:

ttnn.Tensor – the output tensor.

Example

# Create a tensor to repeat
input_tensor = torch.tensor([[1, 2], [3, 4]])
input_tensor_tt = ttnn.from_torch(input_tensor, device=device)

# Repeat the tensor along specified dimensions
repeated_tensor = ttnn.repeat(input_tensor_tt, (1, 2))
print("Repeated Tensor Shape:", repeated_tensor.shape)  # Repeated Tensor Shape: Shape([2, 4])