onnx_graph_info: ONNX graph structure

View source: R/onnx.R

onnx_graph_infoR Documentation

ONNX graph structure

Description

The parsed graph as a table: one row per node, with its operator type and the names of its inputs and outputs. Use it to find which node produces a given edge, or what an edge feeds into, without re-parsing the file.

Usage

onnx_graph_info(model, producer_of = NULL, consumer_of = NULL)

Arguments

model

An onnx_model object from onnx_load().

producer_of

Optional edge name. When given, returns the rows whose node lists that name among its outputs.

consumer_of

Optional edge name. When given, returns the rows whose node lists that name among its inputs.

Details

Reading the structure beats searching the .onnx binary for a name: a name occurs both as a producer's output and as its consumers' input, and telling those apart by hand means getting the protobuf field numbers right every time.

Value

A data frame with columns index, op_type, output (the first output) and list-columns outputs and inputs.

Examples


if (file.exists("model.onnx")) {
  m <- onnx_load("model.onnx")
  g <- onnx_graph_info(m)
  head(g)
  onnx_graph_info(m, producer_of = "881")
}


ggmlR documentation built on Oct. 23, 2026, 1:07 a.m.