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.
- 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.
ParseFromString(self, data: bytes, options: object | None = None) -> None
Parses a sequence of bytes to fill this instance.
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_sizeis not empty, big weights are stored in this (depending onoptions.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_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.
- 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