EncodedValueProto#

Contains encoded bytes, an affine or structured layout, and a logical type. parameter_ref references model-scoped numerical parameters rather than embedding them. See Quantizes tensors into encoded values.

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

One value container with an optional logical tensor type and shape, a layout choice and an owned or external payload with a known byte extent. Payload byte length and the resolved element size determine the record count; no physical shape or redundant count is serialized.

ByteSize(self) → int#

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

Clear(self) → None#

Clears the object.

ClearField(self, field_name: str) → None#

Clears the field field_name, following the protobuf API.

CopyFrom(self, arg: onnx_light.onnx_py._onnxpyprotoop.EncodedValueProto, /) → None#

Copies one instance into this one.

HasField(self, field_name: str) → bool#

Checks if a field is set, following the protobuf HasField API.

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._onnxpyprotoop.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.

SerializeToFileDescriptor(self, fd: int, options: object | None = None) → None#

Serializes this instance into an open file descriptor without closing it.

SerializeToOStream(self, output: object) → None#

Alias for SerializeToOstream (capital S) for protobuf API compatibility. Serializes this instance to a Python file-like object that has a write() method.

SerializeToOstream(self, output: object) → None#

Serializes this instance to a Python file-like object that has a write() method.

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

Serializes this instance into a sequence of bytes.

WhichOneof(self, oneof_name: str) → object#
add_affine(self) → onnx_light.onnx_py._onnxpyprotoop.AffineLayoutProto#

Sets an empty value.

add_logical_type(self) → onnx_light.onnx_py._onnxpyprotoop.TypeProto#

Sets an empty value.

add_struct_type(self) → onnx_light.onnx_py._onnxpyprotoop.StructTypeProto#

Sets an empty value.

property affine#

Built-in affine layout.

property data_location#

DEFAULT reads raw_data, EXTERNAL reads the external payload.

property doc_string#

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

property external_data#

External payload description. data_location == EXTERNAL requires a ‘location’ entry and an explicit ‘length’; ‘offset’ is optional.

has_affine(self) → bool#

Tells if ‘affine’ has a value.

has_data_location(self) → bool#
has_doc_string(self) → bool#

Tells if ‘doc_string’ has a value

has_external_data(self) → bool#

Tells if ‘external_data’ has a value.

has_layout(self) → bool#
has_logical_type(self) → bool#

Tells if ‘logical_type’ has a value.

has_name(self) → bool#

Tells if ‘name’ has a value

has_parameter_ref(self) → bool#

Tells if ‘parameter_ref’ has a value

has_raw_data(self) → bool#
has_struct_type(self) → bool#

Tells if ‘struct_type’ has a value.

property logical_type#

Decoded type and shape when the value denotes a tensor. It is required, with concrete dimensions, for the affine branch.

property name#

Name of the value; graph-scoped and unique across all initializers.

property parameter_ref#

Model-level shared numerical quantization parameter set.

property raw_data#

Inline payload holding a flat sequence of encoded records. It is mutually exclusive with external_data, and an empty inline payload represents zero records.

property struct_type#

an exact type_ref or a concrete inline declaration eligible for byte encoding.

Type:

Structured layout