Int4WeightOnlyEmbedding¶
- class torchao.quantization.qat.embedding.Int4WeightOnlyEmbedding(num_embeddings: int, embedding_dim: int, padding_idx: Optional[int] = None, max_norm: Optional[float] = None, norm_type: float = 2.0, scale_grad_by_freq: bool = False, sparse: bool = False, group_size: int = 32, scale_precision: dtype = torch.float32, zero_point_precision: dtype = torch.int32, device: device = None, output_dtype: dtype = torch.float32)[source]¶
This module implements a embedding layer with int4 quantized grouped per channel weights.
- forward(x)[source]¶
Define the computation performed at every call.
Should be overridden by all subclasses.
Note
Although the recipe for forward pass needs to be defined within this function, one should call the
Module
instance afterwards instead of this since the former takes care of running the registered hooks while the latter silently ignores them.