scatter_nd

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

Scatter updates into a new array according to indices.

Parameters
  • 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.

Returns

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