class_docstr: Prepares the model for QAT by inserting weight and activation quantizers as
  specified in qconfig_mapping.
  
  Implements additional graph passes on a prepared module returned by prepare_qat_fx.
class_docstr_tok: ["Prepares","the","model","for","QAT","by","inserting","weight","and","activation","quantizers","as","specified","in","qconfig_mapping",".","Implements","additional","graph","passes","on","a","prepared","module","returned","by","prepare_qat_fx","."]
docstr: Changes qscheme of embedding layers from float qparams to integer qparams.
docstr_tok: ["Changes","qscheme","of","embedding","layers","from","float","qparams","to","integer","qparams","."]
code: def _replace_weight_fake_quant_for_embedding_layers(
      self, model: _fx.GraphModule
  ):
      """
      Changes qscheme of embedding layers from float qparams to integer qparams.
      """
      for node in model.graph.nodes:
          if node.op == "call_module":
              layer = _find_target(model, node.target)
              if isinstance(layer, _torch.nn.Embedding) and hasattr(
                  layer, "weight_fake_quant"
              ):
                  weight_dtype = layer.weight_fake_quant.dtype
                  delattr(layer, "weight_fake_quant")
                  layer.weight_fake_quant = _aoquant.FakeQuantize(
                      observer=type(
                          layer.qconfig.weight().activation_post_process
                      ),
                      dtype=weight_dtype,
                      qscheme=_QuantizationScheme.get_qscheme(
                          self._quantization_scheme, is_per_channel=True
                      ),
                  )
  
imports: from collections import defaultdict
  from typing import Any
  from typing import Optional
  import torch
  import torch.ao.quantization
  import torch.fx
  import torch.nn
  import torch.nn.intrinsic
  import torch.nn.intrinsic.qat
  from torch.ao.quantization.backend_config import BackendConfig
  from torch.ao.quantization.fx.custom_config import PrepareCustomConfig
  from torch.quantization.quantize_fx import prepare_qat_fx
  import coremltools.optimize.torch.quantization.modules.qat_modules
  from coremltools.optimize.torch._utils.torch_utils import get_parent_child_name
  from coremltools.optimize.torch.quantization._backend_config import _fixed_qparams_modules
  from coremltools.optimize.torch.quantization._utils import CombinationOpType
  from coremltools.optimize.torch.quantization._utils import combine_op_type
  from coremltools.optimize.torch.quantization._utils import find_module
  from coremltools.optimize.torch.quantization._utils import find_target
  from coremltools.optimize.torch.quantization._utils import get_share_qparams_ops
  from coremltools.optimize.torch.quantization._utils import group_activation_quantization_modules_by_id
  from coremltools.optimize.torch.quantization._utils import is_activation_post_process
  from coremltools.optimize.torch.quantization._utils import is_quantized
  from coremltools.optimize.torch.quantization.quantization_config import QuantizationScheme
label_desc: Use image node_id 9 for calling the QATConfigurationHandler obj's underlying member method code with example usage: obj._replace_weight_fake_quant_for_embedding_layers(model) without return types