For the complete documentation index, see llms.txt. Markdown versions of all pages are available by appending .md to any URL (e.g. /max/get-started.md).
Mojo function
gather_guards
def gather_guards(axis: Axis, input_shape: IndexList[element_type=input_shape.element_type], indices_shape: IndexList[element_type=indices_shape.element_type], output_shape: IndexList[element_type=output_shape.element_type])
Validates that the input, indices, and output shapes are compatible for a gather operation.
Args:
- βaxis (
Axis): Axis along which the gather is performed; must be non-negative and less thaninput_shaperank. - βinput_shape (
IndexList[element_type=input_shape.element_type]): Shape of the input tensor being gathered from. - βindices_shape (
IndexList[element_type=indices_shape.element_type]): Shape of the indices tensor. - βoutput_shape (
IndexList[element_type=output_shape.element_type]): Shape of the output tensor; must match the gather output shape derived frominput_shapeandindices_shape.
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?
Thank you! We'll create more content like this.
Thank you for helping us improve!