ttnn.scatter_add

ttnn.scatter_add(input: ttnn.Tensor, dim: int, index: ttnn.Tensor, src: ttnn.Tensor, *, memory_config: ttnn.MemoryConfig = None, sub_core_grids: ttnn.CoreRangeSet = None) ttnn.Tensor

Scatters the source tensor’s values along a given dimension according to the index tensor, adding source values associated with according repeated indices.

Parameters:
  • input (ttnn.Tensor) – the input tensor to scatter values onto.

  • dim (int) – the dimension to scatter along.

  • index (ttnn.Tensor) – the tensor specifying indices where values from the source tensor must go to.

  • src (ttnn.Tensor) – the tensor containing the source values to be scattered onto input.

Keyword Arguments:
  • memory_config (ttnn.MemoryConfig, optional) – memory configuration for the output tensor. Defaults to None.

  • sub_core_grids (ttnn.CoreRangeSet, optional) – specifies which cores scatter should run on. Defaults to None.

Returns:

ttnn.Tensor – the output tensor with scattered values.

Note

  • Input tensors must be interleaved and on device.