ttnn.indexed_fill

ttnn.indexed_fill(batch_id: ttnn.Tensor, input_tensor_a: ttnn.Tensor, input_tensor_b: ttnn.Tensor, *, memory_config: ttnn.MemoryConfig | None = None, dim: int | None = 0, queue_id: int | None = 0) ttnn.Tensor

Replaces batch of input in input_b denoted by batch_ids into input_a.

Parameters:
Keyword Arguments:
  • memory_config (ttnn.MemoryConfig, optional) – Memory configuration for the operation. Defaults to None.

  • dim (int, optional) – Dimension value. Defaults to 0.

  • queue_id (int, optional) – command queue id. Defaults to 0.

Returns:

ttnn.Tensor – the output tensor.

Example

>>> batch_id = ttnn.to_device(ttnn.from_torch(torch.tensor((1, 2), dtype=torch.UINT32)), device=device)
>>> input_a = ttnn.to_device(ttnn.from_torch(torch.tensor((1, 2), dtype=torch.bfloat16)), device=device)
>>> input_b = ttnn.to_device(ttnn.from_torch(torch.tensor((0, 1), dtype=torch.bfloat16)), device=device)
>>> output = ttnn.indexed_fill(batch_id, tensor1, tensor2)