MapProto#

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

Specifies an associative table, defined by keys and values. MapProto is formed with a repeated field of keys (of type INT8, INT16, INT32, INT64, UINT8, UINT16, UINT32, UINT64, or STRING) and values (of type TENSOR, SPARSE_TENSOR, SEQUENCE, or MAP). Key types and value types have to remain the same throughout the instantiation of the MapProto.

ByteSize(self) int#

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

CopyFrom(self, arg: onnx_light.onnx_py._onnxpy.MapProto, /) 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.

has_keys(self) bool#

Tells if ‘keys’ has a value.

has_name(self) bool#

Tells if ‘name’ has a value

has_string_keys(self) bool#

Tells if ‘string_keys’ has a value.

has_values(self) bool#

Tells if ‘values’ has a value.

property key_type#

The data type of the key. This field MUST have a valid TensorProto.DataType value of INT8, INT16, INT32, INT64, UINT8, UINT16, UINT32, UINT64, or STRING

property keys#

Every element of keys has to be one of the following data types INT8, INT16, INT32, INT64, UINT8, UINT16, UINT32, UINT64, or STRING. The integer cases are represented by the repeated int64 field keys below.

property name#

An optional identifier for this map.

property string_keys#

If keys are strings, they are represented by the repeated bytes field string_keys below.

property values#

MapProto values are represented in a SequenceProto of the same length as the repeated keys field and have to be one of the following data types TENSOR, SPARSE_TENSOR, MAP, SEQUENCE.