ivy.scatter_nd(indices: Union[ivy.Array, ivy.NativeArray], updates: Union[ivy.Array, ivy.NativeArray], shape: Iterable[int], reduction: str = 'sum', dev_str: Optional[str] = None, f: Optional[ivy.Framework] = None) → Union[ivy.Array, ivy.NativeArray][source]

Scatter updates into a new array according to indices.

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

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

  • shape (sequence of ints) – The shape of the result.

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

  • 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