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, aslice, atuple, or a list.- Parameters:
g – the graph builder
sts – known shapes and types; when
Nonethe function sets type and shape on the output itselfoutputs – list of output tensor names;
outputs[0]is the resultnode – the
torch.fx.Noderepresenting the subscript operation
- Returns:
name of the result tensor (or ONNX node)