yobx.torch.interpreter._aten_getitem#

Standalone implementations of the getitem operator and its slice/index helpers. These functions mirror the methods that used to live on FxGraphInterpreter but accept a GraphBuilder as their first argument so they can be used independently of the interpreter.

yobx.torch.interpreter._aten_getitem.getitem(g: GraphBuilderTorchProtocol, sts: Dict[str, Any] | None, outputs: List[str], node: torch.fx.Node)[source]#

Converts a getitem (something[...]) node to ONNX.

The index may be another variable (a torch.fx.Node), an integer, a slice, a tuple, or a list.

Parameters:
  • g – the graph builder

  • sts – known shapes and types; when None the function sets type and shape on the output itself

  • outputs – list of output tensor names; outputs[0] is the result

  • node – the torch.fx.Node representing the subscript operation

Returns:

name of the result tensor (or ONNX node)