ShardedDimProto#

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

Describes the sharding spec for a single axis of a sharded tensor.

ByteSize(self) int#

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

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

This field MUST be present for this version of the IR. The axis this sharding corresponds to. Must be in the range of [-r, r - 1], where r is the rank of the tensor. Negative axis values means counting from the back.

has_axis(self) bool#

Tells if ‘axis’ has a value.

has_simple_sharding(self) bool#

Tells if ‘simple_sharding’ has a value.

property simple_sharding#

Describes how the tensor on the provided axis is sharded. The common-case is described by a single instance of SimpleShardedDimProto. Multiple instances can be used to handle cases where a sharded tensor is reshaped, fusing multiple axes into one.