ir_pb_converter.h#
Defines
-
fail_convert(...)#
Throws ConvertError with a formatted message.
-
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.Functions
Serializes an IR graph into a ModelProto.
The graph content is appended to
p_mas a new graph entry and its opset imports are synchronized with graph opset versions.- Parameters:
p_m – Destination model proto.
g – Source IR graph.
-
std::unique_ptr<Graph> ImportModelProto(const ModelProto &mp)#
Converts the first graph in a ModelProto into the internal IR graph.
- Throws:
ConvertError – When protobuf content cannot be represented in the internal IR.
- Returns:
Imported graph represented as an internal IR graph.
-
ModelProto PrepareOutput(const ModelProto &mp_in)#
Produces a metadata-preserving model shell used by conversion pipelines.
This helper copies global model-level fields while leaving graphs empty so conversion passes can repopulate the graph with transformed content.
- Returns:
ModelProto containing copied model-level metadata and no graph data.
Validates that graph conversion returned a non-null graph pointer.
Triggers ONNX_ASSERTM when
gis null.
-
class ConvertError : public std::runtime_error#
- #include <ir_pb_converter.h>
Exception type used by the protobuf <-> IR conversion utilities.
The converter progressively appends context while unwinding nested conversion calls so the final error message points to the failing model location.
Public Functions
-
inline const char *what() const noexcept override#
-
inline const char *what() const noexcept override#