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_elements
def gather_elements[input_type: DType, indices_type: DType](input: TileTensor[input_type, Storage=input.Storage, address_space=input.address_space, linear_idx_type=input.linear_idx_type], indices: TileTensor[indices_type, Storage=indices.Storage, address_space=indices.address_space, linear_idx_type=indices.linear_idx_type], _axis: Int, output: TileTensor[input_type, Storage=output.Storage, address_space=output.address_space, linear_idx_type=output.linear_idx_type], ctx: DeviceContext)
Implements ONNX GatherElements op which is equivalent to Pytorch gather.
Parameters:
- βinput_type (
DType): Element type ofinputandoutput. - βindices_type (
DType): Element type of theindicestensor, must beint32orint64.
Args:
- βinput (
TileTensor[input_type, Storage=input.Storage, address_space=input.address_space, linear_idx_type=input.linear_idx_type]): Source tensor to gather values from. - βindices (
TileTensor[indices_type, Storage=indices.Storage, address_space=indices.address_space, linear_idx_type=indices.linear_idx_type]): Tensor of indices to gather along_axis, shaped the same asoutput. Values must be in range [-dim, dim) along_axis. - β_axis (
Int): Axis along which to gather frominput, in range [-rank, rank). - βoutput (
TileTensor[input_type, Storage=output.Storage, address_space=output.address_space, linear_idx_type=output.linear_idx_type]): Destination tensor for gathered values, shaped the same asindices. - βctx (
DeviceContext): Device context for execution.
Was this page helpful?
Thank you! We'll create more content like this.
Thank you for helping us improve!