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: If a fixed qparams activation is fused, with conv/linear, we need to make sure
  its qconfig is inherited by the fused op's activation quantizer. Before this step,
  all fused layers will have symmetric/affine activation quantizer.
docstr_tok: ["If","a","fixed","qparams","activation","is","fused",",","with","conv\/linear",",","we","need","to","make","sure","its","qconfig","is","inherited","by","the","fused","op","'s","activation","quantizer",".","Before","this","step",",","all","fused","layers","will","have","symmetric\/affine","activation","quantizer","."]
code: def _mark_fixed_qparams_modules_for_replacement(
      self, model: _fx.GraphModule
  ):
      """
      If a fixed qparams activation is fused, with conv/linear, we need to make sure
      its qconfig is inherited by the fused op's activation quantizer. Before this step,
      all fused layers will have symmetric/affine activation quantizer.
      """
      for node in model.graph.nodes:
          if node.op == "call_module":
              layer = _find_target(model, node.target)
              if isinstance(
                  layer,
                  (_qat.ConvAct2d, _qat.ConvBnAct2d, _qat.LinearAct),
              ):
                  # If output of this layer is being cat with another layer, we don't want
                  # to enforce that layer to use the same activation quantizer, so we ignore it
                  if _torch.cat in [
                      child_node.target
                      for child_node in self._act_quant_groups[
                          id(layer)
                      ]
                  ]:
                      continue
                  elif type(layer.act) in _fixed_qparams_modules:
                      act_post_process = (
                          self._qconfig_mapping.object_type_qconfigs[
                              type(layer.act)
                          ].activation()
                      )
                      self._mark_act_post_process_for_replacement(
                          node, model, act_post_process
                      )
  
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 8 for calling the QATConfigurationHandler obj's underlying member method code with example usage: obj._mark_fixed_qparams_modules_for_replacement(model) without return types