IMPORTANT: To view this page as Markdown, append `.md` to the URL (e.g. /get-started.md). For the complete documentation index, see llms.txt.
Skip to main content
For the complete documentation index, see llms.txt. Markdown versions of all pages are available by appending .md to any URL (e.g. /get-started.md).

Mojo function

gather_guards

def gather_guards[input_rank: Int, indices_rank: Int, output_rank: Int](axis: Axis, input_shape: DynamicCoord[.int64, input_rank], indices_shape: DynamicCoord[.int64, indices_rank], output_shape: DynamicCoord[.int64, output_rank])

Validates that the input, indices, and output shapes are compatible for a gather operation.

Parameters:

  • ​input_rank (Int): Rank of the input tensor.
  • ​indices_rank (Int): Rank of the indices tensor.
  • ​output_rank (Int): Rank of the output tensor.

Args:

Raises:

If the axis is negative, out of range, or the output shape does not match the expected gather shape derived from the input and indices.

Was this page helpful?