ivy.scatter_flat(indices, updates, size, reduction='sum', dev_str=None, f=None)[source]

Scatter flat updates into a new flat array according to flat indices.

  • indices (array) – Indices for the new values to occupy.

  • updates (array) – Values for the new array to hold.

  • size (int) – The size of the result.

  • reduction (str) – The reduction method for the scatter, one of ‘sum’, ‘min’, ‘max’ or ‘replace’

  • dev_str (str, optional) – device on which to create the array ‘cuda:0’, ‘cuda:1’, ‘cpu’ etc. Same as updates if None.

  • f (ml_framework, optional) – Machine learning framework. Inferred from inputs if None.


New array of given shape, with the values scattered at the indices.

Supported Frameworks:

empty jax_logo empty tf_logo empty pytorch_logo empty mxnet_logo empty numpy_logo empty