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 struct

GatherSum

struct GatherSum

Registers the mo.gather_sum graph op with the graph compiler.

Implemented traitsโ€‹

AnyType, Deinitable, Movable

Methodsโ€‹

executeโ€‹

static def execute[target: StringSpan[ImmStaticOrigin]](output: ManagedTensorSlice[IOSpec[_, _].Output, static_spec=output.static_spec], input: ManagedTensorSlice[IOSpec[_, _].Input, static_spec=input.static_spec], indices: ManagedTensorSlice[IOSpec[_, _].Input, static_spec=indices.static_spec], ctx: DeviceContextBase)

Fused gather (axis 0) + sum reduction (axis 1).

Dispatches to the CPU gather_reduce kernel or the GPU gather_sum kernel based on target.

Was this page helpful?