tenzr::PartitionSpec¶
Per-dimension list of mesh axis names describing how a tensor is partitioned.
#include <partition_spec.h>
Public Types¶
| Name | |
|---|---|
| using std::vector< std::string > | DimSpec |
Public Functions¶
| Name | |
|---|---|
| PartitionSpec() =default | |
| PartitionSpec(std::initializer_list< DimSpec > dims) | |
| PartitionSpec(std::vector< DimSpec > dims) | |
| PartitionSpec(std::initializer_list< std::string > single_axes) | |
| size_t | Rank() const Number of tensor dimensions described. |
| bool | Empty() const Whether the spec describes no dimensions. |
| const std::vector< DimSpec > & | Partitions() const Per-dimension axis-name lists. |
| const DimSpec & | operator[](size_t index) const |
| bool | IsReplicated(size_t index) const |
| bool | IsUnconstrained(size_t index) const |
| std::string | ToString() const Render the spec as a string. |
| std::string | ToShardyDimsString() const Format partitions for Shardy MLIR attribute: e.g. [{"data"}, {}] or [{"data"}, {?}]. |
| bool | operator==(const PartitionSpec & other) const |
| bool | operator!=(const PartitionSpec & other) const |
Public Attributes¶
| Name | |
|---|---|
| const DimSpec | kNone Sentinel representing an unpartitioned / replicated dimension. |
| const DimSpec | kUnconstrained Sentinel representing an unconstrained dimension in Shardy. |
Public Types Documentation¶
using DimSpec¶
Public Functions Documentation¶
function PartitionSpec¶
function PartitionSpec¶
function PartitionSpec¶
function PartitionSpec¶
function Rank¶
Number of tensor dimensions described.
function Empty¶
Whether the spec describes no dimensions.
function Partitions¶
Per-dimension axis-name lists.
function operator[]¶
function IsReplicated¶
Parameters:
- index Tensor dimension index.
Return: True when the dimension is unpartitioned.
Whether a dimension is replicated.
function IsUnconstrained¶
Parameters:
- index Tensor dimension index.
Return: True when the dimension carries the ? sentinel.
Whether a dimension is unconstrained.
function ToString¶
Render the spec as a string.
function ToShardyDimsString¶
Format partitions for Shardy MLIR attribute: e.g. [{"data"}, {}] or [{"data"}, {?}].
function operator==¶
function operator!=¶
Public Attributes Documentation¶
variable kNone¶
Sentinel representing an unpartitioned / replicated dimension.
variable kUnconstrained¶
Sentinel representing an unconstrained dimension in Shardy.