node_helpers.h#
Small helpers shared by the dispatcher (run_nodes.cc) and the kernel dispatch table (kernel_dispatch_table.cc).
The helpers normalise the default ONNX domain, validate input/output arity declared on a NodeProto, look up tensors by name in a RuntimeContext and read the most common attribute types (INT, INTS, FLOAT, STRING). Their definitions live in node_helpers.cc (part of lib_onnx_core).
-
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 runtime
Functions
-
void SetOutput(const NodeProto &node, int index, Tensor result, RuntimeContext &rt)#
-
const Sequence &GetInputSequence(const NodeProto &node, int index, const RuntimeContext &rt)#
-
void SetOutputSequence(const NodeProto &node, int index, Sequence result, RuntimeContext &rt)#
-
const AttributeProto *FindAttribute(const NodeProto &node, std::string_view name)#
-
const GraphProto &GetRequiredGraphAttribute(const NodeProto &node, std::string_view name)#
-
ParamInts GetAttributeIntsOrDefault(const NodeProto &node, const std::string &name, const std::vector<int64_t> &fallback)#
-
Shape GetAttributeShapeOrDefault(const NodeProto &node, const std::string &name, const Shape &fallback)#
Reads the repeated INTS attribute
nameofnodeand returns it as aShape. When the attribute is absent,fallbackis returned unchanged. Throws when the attribute exists but has a type other than INTS.
-
ParamFloats GetAttributeFloatsOrDefault(const NodeProto &node, const std::string &name, const std::vector<float> &fallback)#
-
ParamStrings GetAttributeStringsOrDefault(const NodeProto &node, const std::string &name, const std::vector<std::string> &fallback)#
-
class ParamFloats : public std::vector<float>#
- #include <node_helpers.h>
Vector-like wrapper for the value returned by :func:
GetAttributeFloatsOrDefault.
-
void SetOutput(const NodeProto &node, int index, Tensor result, RuntimeContext &rt)#
-
namespace runtime
-
namespace core