mlx_graphs.utils.scatter.scatter_add

Contents

mlx_graphs.utils.scatter.scatter_add#

mlx_graphs.utils.scatter.scatter_add(src: mlx.core.array, index: mlx.core.array, values: mlx.core.array)[source]#

Scatters values at index within src. If duplicate indices are present, the sum of the values will be assigned to these index.

Parameters:
  • src (array) – Source array where the values will be scattered (often an empty array)

  • index (array) – Array containing indices that determine the scatter of the ‘values’.

  • values (array) – Input array containing values to be scattered.

Returns:

The resulting array after applying scatter and sum operations on the values at duplicate indices