GraphProto#

class onnx_light.onnx.GraphProto(*args, **kwargs)#

A graph defines the computational logic of a model and is comprised of a parameterized list of nodes that form a directed acyclic graph based on their inputs and outputs. This is the equivalent of the ‘network’ or ‘graph’ in many deep learning frameworks.

ByteSize(self) int#

Returns the serialized size in bytes, following the protobuf API.

CopyFrom(self, arg: onnx_light.onnx_py._onnxpy.GraphProto, /) None#

Copies one instance into this one.

ParseFromFile(self, name: str, options: object | None = None, external_data_file: str = '') None#

Parses a binary file to fill this instance.

ParseFromString(self, data: bytes, options: object | None = None) None#
ParseFromString(self, data: str, options: object | None = None) None

Overloaded function.

  1. ParseFromString(self, data: bytes, options: object | None = None) -> None

Parses a sequence of bytes to fill this instance.

  1. ParseFromString(self, data: str, options: object | None = None) -> None

Parses a string to fill this instance.

SerializeSize(self, options: object | None = None) onnx_light.onnx_py._onnxpy.SerializeSizeResult#

Returns the size once serialized without serializing.

SerializeToFile(self, name: str, options: object | None = None, external_data_file: str = '') None#

Serializes this instance into a file. If external_data_size is not empty, big weights are stored in this (depending on options.raw_data_threshold). When writing to two files, temporary external-data metadata is cleared so the in-memory model stays unchanged.

SerializeToString(self, options: object | None = None) bytes#

Serializes this instance into a sequence of bytes.

property doc_string#

A human-readable documentation for this graph. Markdown is allowed.

has_doc_string(self) bool#

Tells if ‘doc_string’ has a value

has_initializer(self) bool#

Tells if ‘initializer’ has a value.

has_input(self) bool#

Tells if ‘input’ has a value.

has_metadata_props(self) bool#

Tells if ‘metadata_props’ has a value.

has_name(self) bool#

Tells if ‘name’ has a value

has_node(self) bool#

Tells if ‘node’ has a value.

has_output(self) bool#

Tells if ‘output’ has a value.

has_quantization_annotation(self) bool#

Tells if ‘quantization_annotation’ has a value.

has_sparse_initializer(self) bool#

Tells if ‘sparse_initializer’ has a value.

has_value_info(self) bool#

Tells if ‘value_info’ has a value.

property initializer#

A list of named sparse tensor values, used to specify constant inputs of the graph. Each initializer (both TensorProto as well SparseTensorProto) MUST have a name. The name MUST be unique across both initializer and sparse_initializer, but the name MAY also appear in the input list.

property input#

Inputs of the graph, shapes and types are optional in a subgraph and mandatory in the main graph.

property metadata_props#

Named metadata values; keys should be distinct.

property name#

The name of the graph.

property node#

The nodes in the graph, sorted topologically.

property output#

Outputs of the graph, shapes and types are optional in a subgraph and mandatory in the main graph.

property quantization_annotation#

For tensor ‘a’, it may have {‘SCALE_TENSOR’, ‘a_scale’} and {‘ZERO_POINT_TENSOR’, ‘a_zero_point’} annotated, which means, tensor ‘a_scale’ and tensor ‘a_zero_point’ are scale and zero point of tensor ‘a’ in the model.

Type:

This field carries information to indicate the mapping among a tensor and its quantization parameter tensors. For example

property sparse_initializer#

A list of named tensor values, used to specify constant inputs of the graph. Each initializer (both TensorProto as well SparseTensorProto) MUST have a name. The name MUST be unique across both initializer and sparse_initializer, but the name MAY also appear in the input list.

property value_info#

Information for the values in the graph. The ValueInfoProto.name’s must be distinct. It is optional for a value to appear in value_info list.