ShardingSpecProto#

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

Describes the sharding spec for a specific, input or output tensor of a node.

ByteSize(self) int#

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

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

The following is the list of devices across which the logical tensor is sharded or replicated.

has_device(self) bool#

Tells if ‘device’ has a value.

has_index_to_device_group_map(self) bool#

Tells if ‘index_to_device_group_map’ has a value.

has_sharded_dim(self) bool#

Tells if ‘sharded_dim’ has a value.

has_tensor_name(self) bool#

Tells if ‘tensor_name’ has a value

property index_to_device_group_map#

Each element v in above field devices may represent either a device or a set of devices (when we want the same shard/tensor to be replicated across a subset of devices), as indicated by the following optional map. If the map contains an entry for v, then v represents a device group, and the map indicates the set of devices in that group.

property sharded_dim#

The following is the sharded-shape of the tensor, consisting of the sharding-spec for each axis of the tensor.

property tensor_name#

This field MUST be present for this version of the IR. Identifies the input or output of the node that is being sharded. Required to match a name specified in the node’s input or output list of ValueInfoProtos. It is called logical tensor in subsequent descriptions.