ivy.gather(params: ivy.NativeArray, indices: ivy.NativeArray, axis: int = - 1, dev_str: Optional[str] = None, f: Optional[ivy.Framework] = None) → ivy.NativeArray[source]

Gather slices from params at axis according to indices.

  • params (array) – The array from which to gather values.

  • indices (array) – Index array.

  • axis (int, optional) – The axis from which to gather from. Default is -1.

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

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


New array with the values gathered at the specified indices along the specified axis.

Supported Frameworks:

empty jax_logo empty tf_logo empty pytorch_logo empty mxnet_logo empty numpy_logo empty