printer.h#

Printing helpers for ONNX protobuf objects, including operator<< overloads for graphs, nodes, attributes, and tensors, as well as onnx::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_NAMESPACE

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.

  • dimDimension 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.

  • tensortypeTensor 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.

  • tensorTensor 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_infoValue 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.

  • vilistValue 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.

  • nodeNode 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.

  • nodelistNode 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.

  • graphGraph 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.