Skip to main content
Log in

Mojo function

gather_shape

gather_shape[output_rank: Int, input_rank: Int, indices_rank: Int, input_type: DType, indices_type: DType, single_thread_blocking_override: Bool = False](input_buf: NDBuffer[input_type, input_rank, origin], indices_buf: NDBuffer[indices_type, indices_rank, origin], axis: Int) -> Index[output_rank]

Compute the output shape of a gather operation, and assert the inputs are compatible.

Parameters:

  • output_rank (Int): Rank of the output tensor.
  • input_rank (Int): Rank of the input tensor.
  • indices_rank (Int): Rank of the indices tensor.
  • input_type (DType): Type of the input tensor.
  • indices_type (DType): Type of the indices tensor.
  • single_thread_blocking_override (Bool): If True, then the operation is run synchronously using a single thread.

Args:

  • input_buf (NDBuffer[input_type, input_rank, origin]): The input tensor.
  • indices_buf (NDBuffer[indices_type, indices_rank, origin]): The indices tensor.
  • axis (Int): The axis.

Returns:

The output shape.