class_docstr: Quantized version of `torch.nn.Embedding`. Adds quantization-specific arguments on top of `torch.nn.Embedding`.
  
  Args:
      weight_bit (`int`, *optional*, defaults to `8`):
          Bitwidth for the quantized weight.
      momentum (`float`, *optional*, defaults to `0.95`):
          Momentum for updating the activation quantization range.
      quant_mode (`bool`, *optional*, defaults to `False`):
          Whether or not the layer is quantized.
class_docstr_tok: ["Quantized","version","of","`","torch.nn.Embedding","`",".","Adds","quantization-specific","arguments","on","top","of","`","torch.nn.Embedding","`",".","Args",":","weight_bit","(","`","int","`",",","*","optional","*",",","defaults","to","`","8","`",")",":","Bitwidth","for","the","quantized","weight",".","momentum","(","`","float","`",",","*","optional","*",",","defaults","to","`","0.95","`",")",":","Momentum","for","updating","the","activation","quantization","range",".","quant_mode","(","`","bool","`",",","*","optional","*",",","defaults","to","`","False","`",")",":","Whether","or","not","the","layer","is","quantized","."]
code: def forward(self, x, positions=None, incremental_state=None):
      if not self.quant_mode:
          return (
              nn.functional.embedding(
                  x,
                  self.weight,
                  self.padding_idx,
                  self.max_norm,
                  self.norm_type,
                  self.scale_grad_by_freq,
                  self.sparse,
              ),
              None,
          )
  
      w = self.weight
      w_transform = w.data.detach()
      w_min = w_transform.min().expand(1)
      w_max = w_transform.max().expand(1)
  
      self.weight_scaling_factor = symmetric_linear_quantization_params(
          self.weight_bit, w_min, w_max, False
      )
      self.weight_integer = self.weight_function(
          self.weight,
          self.weight_bit,
          self.percentile_mode,
          self.weight_scaling_factor,
      )
  
      emb_int = nn.functional.embedding(
          x,
          self.weight_integer,
          self.padding_idx,
          self.max_norm,
          self.norm_type,
          self.scale_grad_by_freq,
          self.sparse,
      )
      return (
          emb_int * self.weight_scaling_factor,
          self.weight_scaling_factor,
      )
  
imports: import decimal
  import numpy
  import torch
  from torch import nn
  from torch.autograd import Function
  from ...utils import logging
label_desc: Use image node_id 2 for calling the QuantEmbedding obj's underlying member method code with example usage: obj.forward(x, positions, incremental_state) and returns: unknown,  self, nn,  None