coreai_opt.palettization.spec.PerGroupedChannelGranularity¶
- class coreai_opt.palettization.spec.PerGroupedChannelGranularity[source]¶
Bases:
PalettizationGranularityPer-grouped-channel palettization granularity.
This applies palettization to a specific channel which is selected through the
axisargument.axisdefaults toNone, in which case the default axis for the consuming op is used (e.g. 0 forLinear/Conv).- get_blocks_to_cluster(weight)[source]¶
Split weight tensor into blocks along the specified axis with group_size.
- Parameters:
weight (Tensor) – The weight tensor to split
- Returns:
List of weight blocks, each of size group_size along the specified axis
- Raises:
_IncompatibleGranularityError – If tensor is incompatible with
this granularity –
- Return type:
list[Tensor]
- num_blocks_to_cluster(weight)[source]¶
Return the number of weight blocks to cluster based on the specified granularity.
- Parameters:
weight (Tensor) – The weight tensor to be palettized
- Returns:
Number of LUTs for the weight tensor
- Raises:
_IncompatibleGranularityError – If the tensor is incompatible with this granularity
- Return type:
int