printer.h#
Printing helpers for ONNX protobuf objects, including operator<< overloads
for graphs, nodes, attributes, and tensors, as well as
onnx_light::ProtoToString().
Declares stream-formatting helpers for ONNX protobuf structures.
This header exposes ostream operator overloads that render ONNX protobuf objects in a compact textual form for diagnostics and debugging, plus a helper template to convert supported protobuf objects to std::string.
-
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
-
std::ostream &operator<<(std::ostream &os, const TensorShapeProto_Dimension &dim)#
Formats and writes a TensorShapeProto_Dimension to an output stream.
- Parameters:
os – The destination stream.
dim – Dimension to format.
- Returns:
A reference to os.
-
std::ostream &operator<<(std::ostream &os, const TensorShapeProto &shape)#
Formats and writes a TensorShapeProto to an output stream.
- Parameters:
os – The destination stream.
shape – Shape to format.
- Returns:
A reference to os.
-
std::ostream &operator<<(std::ostream &os, const TypeProto_Tensor &tensortype)#
Formats and writes a TypeProto_Tensor to an output stream.
- Parameters:
os – The destination stream.
tensortype – Tensor type to format.
- Returns:
A reference to os.
-
std::ostream &operator<<(std::ostream &os, const TypeProto &type)#
Formats and writes a TypeProto to an output stream.
- Parameters:
os – The destination stream.
type – Type to format.
- Returns:
A reference to os.
-
std::ostream &operator<<(std::ostream &os, const TensorProto &tensor)#
Formats and writes a TensorProto to an output stream.
- Parameters:
os – The destination stream.
tensor – Tensor to format.
- Returns:
A reference to os.
-
std::ostream &operator<<(std::ostream &os, const ValueInfoProto &value_info)#
Formats and writes a ValueInfoProto to an output stream.
- Parameters:
os – The destination stream.
value_info – Value info to format.
- Returns:
A reference to os.
-
std::ostream &operator<<(std::ostream &os, const ValueInfoList &vilist)#
Formats and writes a ValueInfoList to an output stream.
- Parameters:
os – The destination stream.
vilist – Value info list to format.
- Returns:
A reference to os.
-
std::ostream &operator<<(std::ostream &os, const AttributeProto &attr)#
Formats and writes an AttributeProto to an output stream.
- Parameters:
os – The destination stream.
attr – Attribute to format.
- Returns:
A reference to os.
-
std::ostream &operator<<(std::ostream &os, const AttrList &attrlist)#
Formats and writes an AttrList to an output stream.
- Parameters:
os – The destination stream.
attrlist – Attribute list to format.
- Returns:
A reference to os.
-
std::ostream &operator<<(std::ostream &os, const NodeProto &node)#
Formats and writes a NodeProto to an output stream.
- Parameters:
os – The destination stream.
node – Node to format.
- Returns:
A reference to os.
-
std::ostream &operator<<(std::ostream &os, const NodeList &nodelist)#
Formats and writes a NodeList to an output stream.
- Parameters:
os – The destination stream.
nodelist – Node list to format.
- Returns:
A reference to os.
-
std::ostream &operator<<(std::ostream &os, const GraphProto &graph)#
Formats and writes a GraphProto to an output stream.
- Parameters:
os – The destination stream.
graph – Graph to format.
- Returns:
A reference to os.
-
std::ostream &operator<<(std::ostream &os, const FunctionProto &fn)#
Formats and writes a FunctionProto to an output stream.
- Parameters:
os – The destination stream.
fn – Function to format.
- Returns:
A reference to os.
-
std::ostream &operator<<(std::ostream &os, const ModelProto &model)#
Formats and writes a ModelProto to an output stream.
- Parameters:
os – The destination stream.
model – Model to format.
- Returns:
A reference to os.
-
template<typename ProtoType>
std::string ProtoToString(const ProtoType &proto)# Converts a streamable ONNX protobuf object to its textual representation.
- Template Parameters:
ProtoType – Type supporting the corresponding stream operator.
- Parameters:
proto – Object to format.
- Returns:
The formatted textual representation of proto.
-
std::ostream &operator<<(std::ostream &os, const TensorShapeProto_Dimension &dim)#