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: Performs graph passes on model to configure activation and weight quantization layers.
docstr_tok: ["Performs","graph","passes","on","model","to","configure","activation","and","weight","quantization","layers","."]
code: def prepare(self, model: _nn.Module, example_inputs: _Any):
      """
      Performs graph passes on model to configure activation and weight quantization layers.
      """
      model = _prepare_qat_fx(
          model,
          prepare_custom_config=self._prepare_custom_config,
          qconfig_mapping=self._qconfig_mapping,
          example_inputs=example_inputs,
          backend_config=self._backend_config,
      )
  
      self._act_quant_groups = (
          _group_activation_quantization_modules_by_id(model)
      )
      if self._quantization_scheme == _QuantizationScheme.symmetric:
          self._mark_always_affine_layers_for_replacement(model)
          self._mark_always_affine_combination_ops_for_replacement(
              model
          )
      self._mark_fixed_qparams_modules_for_replacement(model)
      self._replace_weight_fake_quant_for_embedding_layers(model)
      model = self._replace_activation_quantizers(model)
      model = self._remove_activation_quantizer_after_dropout(model)
      return model
  
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 2 for calling the QATConfigurationHandler obj's underlying member method code with example usage: obj.prepare(model, example_inputs) and returns: model