StructTypeProto#

Declares structures, arrays and bit-packed records, or references a declaration in ModelProto.struct_types by type_ref. See Quantizes tensors into encoded values for layout and catalogue semantics.

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

Describes a struct’s fields and types: a concrete declaration selects array, bit_packing or structure, and each field selects either a value type or a tensor constant. A fixed physical size is an eligibility condition for byte encoding, not a requirement on every struct.

class Array(*args, **kwargs)#

A tight repetition of a single element type.

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.StructTypeProto.Array, /) → 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.

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

Sets an empty value.

property dimension#

Number of elements, an explicit concrete count.

property element_type#

Type of one element.

has_dimension(self) → bool#

Tells if ‘dimension’ has a value.

has_element_type(self) → bool#

Tells if ‘element_type’ has a value.

class BitPacking(*args, **kwargs)#

A tight repetition of a group of named bit fields.

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.

class Component(*args, **kwargs)#

One named bit field inside a bit-packing group.

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.StructTypeProto.BitPacking.Component, /) → 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.

property bit_width#

Width of the component in bits, strictly positive.

has_bit_width(self) → bool#

Tells if ‘bit_width’ has a value.

has_name(self) → bool#

Tells if ‘name’ has a value

property name#

Component name, unique within the enclosing bit packing.

CopyFrom(self, arg: onnx_light.onnx_py._onnxpyprotoop.StructTypeProto.BitPacking, /) → 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.

property component#

Components of one group, laid out from the least significant bit.

property dimension#

Number of repeated groups, an explicit concrete count.

has_component(self) → bool#

Tells if ‘component’ has a value.

has_dimension(self) → bool#

Tells if ‘dimension’ has a value.

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.StructTypeProto, /) → 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.

class Structure(*args, **kwargs)#

An ordered list of named fields.

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.StructTypeProto.Structure, /) → None#

Copies one instance into this one.

class Field(*args, **kwargs)#

One named field holding either a value type or a shared format constant.

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.StructTypeProto.Structure.Field, /) → 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_constant(self) → onnx_light.onnx_py._onnxpyprotoop.TensorProto#

Sets an empty value.

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

Sets an empty value.

property constant#

The actual shared format constant, not a graph input. It must have concrete dimensions and matching data, and contributes zero payload bytes.

property doc_string#

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

has_constant(self) → bool#

Tells if ‘constant’ has a value.

has_content(self) → bool#
has_doc_string(self) → bool#

Tells if ‘doc_string’ has a value

has_name(self) → bool#

Tells if ‘name’ has a value

has_type(self) → bool#

Tells if ‘type’ has a value.

property name#

Field name, unique within the enclosing structure.

property type#

Type of the field value. It follows the existing TypeProto validation rules for tensors, nested structs, sequences, maps and optional values.

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.

property field#

Fields in declaration order.

has_field(self) → bool#

Tells if ‘field’ has a value.

WhichOneof(self, oneof_name: str) → object#
add_array(self) → onnx_light.onnx_py._onnxpyprotoop.StructTypeProto.Array#

Sets an empty value.

add_bit_packing(self) → onnx_light.onnx_py._onnxpyprotoop.StructTypeProto.BitPacking#

Sets an empty value.

add_decoder(self) → onnx_light.onnx_py._onnxpyprotoop.FunctionProto#

Sets an empty value.

add_encoder(self) → onnx_light.onnx_py._onnxpyprotoop.FunctionProto#

Sets an empty value.

add_structure(self) → onnx_light.onnx_py._onnxpyprotoop.StructTypeProto.Structure#

Sets an empty value.

property array#

Array declaration.

property bit_packing#

Bit-packing declaration.

property decoder#

Optional decoder. Only the concrete root’s codec is invoked; a nested type_ref contributes layout and constants but not its own decoder or encoder.

property doc_string#

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

property encoder#

Optional encoder, mirroring decoder.

has_array(self) → bool#

Tells if ‘array’ has a value.

has_bit_packing(self) → bool#

Tells if ‘bit_packing’ has a value.

has_decoder(self) → bool#

Tells if ‘decoder’ has a value.

has_doc_string(self) → bool#

Tells if ‘doc_string’ has a value

has_encoder(self) → bool#

Tells if ‘encoder’ has a value.

has_kind(self) → bool#
has_metadata_props(self) → bool#

Tells if ‘metadata_props’ has a value.

has_name(self) → bool#

Tells if ‘name’ has a value

has_structure(self) → bool#

Tells if ‘structure’ has a value.

has_type_id(self) → bool#

Tells if ‘type_id’ has a value.

has_type_ref(self) → bool#

Tells if ‘type_ref’ has a value.

property metadata_props#

Named metadata values; keys should be distinct.

property name#

A human-readable name for this declaration.

property structure#

Structure declaration.

property type_id#

Nonzero, model-scoped stable format identity. Each ID has exactly one declaration in ModelProto.struct_types; an inline declaration has no type_id and cannot be referenced.

property type_ref#

declaration fields, metadata, codecs and another kind must be absent.

Type:

Reference to a declaration in ModelProto.struct_types. A type_ref carries only the referenced ID