onnx_pb.h#
Central header that takes the role of the protobuf-generated onnx_pb.h in the standard ONNX package.
Why this file exists
In the standard onnx package every message class (ModelProto, TensorProto, etc.) is auto-generated by the protoc compiler from the ONNX .proto schema files, and the generated translation unit is named onnx_pb.h. That file is the single include point relied on by almost all ONNX C++ source files to pull in the message types and the ONNX_LIGHT_NAMESPACE / ONNX_API macros.
onnx-light eliminates the protobuf dependency entirely: message classes are hand-written in onnx_light/onnx/onnx_proto/onnx.h using a set of code-generation macros (BEGIN_PROTO, FIELD, etc.) defined in stream_class.h. This file acts as the drop-in replacement for the protobuf-generated onnx_pb.h; it includes the hand-crafted message types and provides the same namespace and export macros so that the rest of the ONNX C++ sources compile unchanged.
Defines
-
ONNX_NAMESPACE#
Namespace used for all onnx-light C++ symbols.
Defaults to
onnx_light. Can be overridden at compile time to allow onnx-light to coexist with the standard onnx library in the same translation unit.Backwards-compatible alias so that code referencing
ONNX_NAMESPACE(the macro used in the standard onnx package) resolves to the same namespace asONNX_LIGHT_NAMESPACE.
-
ONNX_LIGHT_ONNX_NAMESPACE_ALIAS_DEFINED#
-
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.
Defined as empty because onnx-light does not require explicit
__declspec(dllexport)or__attribute__((visibility("default")))annotations — visibility is controlled at the shared-library level. The macro is provided so that vendored ONNX headers that decorate their declarations withONNX_APIcompile without modification.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.