Skip to main content
Log in

Mojo function

gather

gather(input: Symbol, indices: Symbol, axis: Int = 0) -> Symbol

Selects elements out of an input tensor by index.

Args:

  • input (Symbol): The input symbolic tensor to select elements from.
  • indices (Symbol): A symbolic tensor of index values to use for selection.
  • axis (Int): The dimension which indices indexes from input. If negative, indexes relative to the end of the input tensor. For instance gather(input, indices, axis=-1) will index against the last dimension of input.

Returns:

A new symbolic tensor representing the result of the gather operation.

Was this page helpful?