graph_manipulations.h#
Lightweight GraphProto / NodeProto manipulation helpers (formerly
onnx_proto/common_functions.h, now implemented in onnx_core),
including onnx_light::core::graph::CollectExternalInputs(),
onnx_light::core::graph::CollectRemainingInputs() and
onnx_light::core::graph::CollectNodeInputs().
-
namespace onnx_light
Alias that makes onnx-light headers compatible with code that references
ONNX_LIGHT_NAMESPACE(the macro used in the standard onnx package).Set to
ONNX_LIGHT_NAMESPACEso both names resolve to the same namespace.Symbol-visibility attribute for the public onnx-light C++ API.
Maps the upstream compatibility macro to onnx-light’s explicit proto ABI annotation. This keeps declarations from vendored ONNX headers visible when
lib_onnx_protouses hidden visibility by default.Namespace alias so that ONNX C++ code (and consumers such as onnxruntime) that refers to the literal
onnxnamespace — rather than theONNX_NAMESPACEmacro — resolves to the onnx-light namespace. The standard onnx package lives innamespace onnx; onnx-light usesonnx_light(via ONNX_LIGHT_NAMESPACE), so this alias keeps onnx-light a true drop-in. It is only introduced when the onnx-light namespace differs fromonnx.-
namespace core
-
namespace graph#
Functions
-
std::vector<std::string> CollectExternalInputs(const utils::RepeatedProtoField<NodeProto> &nodes)#
Returns the list of input names referenced by
nodesthat are not produced as outputs by any node in the same list.Recursively inspects subgraph attributes (
GRAPH/GRAPHS) and appends names read by subgraph nodes when neither the subgraph nor the outernodesproduce those names.The returned list preserves first-seen order and contains no duplicates. Empty input names are skipped.
-
std::vector<std::string> CollectExternalInputs(const std::vector<const NodeProto*> &nodes)#
Node-pointer overload of :cpp:func:
CollectExternalInputs, used to collect the external inputs of an :cpp:class:ExecutionPlan’s node list.
-
std::vector<std::vector<std::string>> CollectRemainingInputs(const utils::RepeatedProtoField<NodeProto> &nodes, const std::vector<std::string> &outputs)#
Returns, for every node in
nodes, the list of input names that must already be available before that node runs in order to eventually produce the requestedoutputs.The algorithm performs a backward reachability analysis: starting from the requested
outputs, it determines the ancestors (the nodes and tensors the outputs transitively depend on). For each indexiit considers the suffixnodes[i..], keeps only the nodes of that suffix that are ancestors ofoutputs(branches that do not contribute tooutputsare pruned), and reports the names those relevant nodes read — including names captured by subgraph attributesGRAPH/GRAPHS— that are not produced within the suffix. Those are the tensors that need to be kept alive before running nodei.nodesis expected to be in topological order. The returned vector has exactlynodes.size()entries. Each inner list preserves first-seen order and contains no duplicates; empty input names are skipped.
-
std::vector<std::string> CollectNodeInputs(const NodeProto &node)#
Returns the full list of tensor / sequence names a single
nodedepends on at runtime.Includes names referenced by
node.input()and external inputs captured by subgraph attributes (GRAPH/GRAPHS), preserves first-seen order without duplicates, and skips empty input names.
-
std::vector<std::string> CollectExternalInputs(const utils::RepeatedProtoField<NodeProto> &nodes)#
-
namespace graph#
-
namespace core