code: def _get_affine_act_post_process(module: _aoquant.FakeQuantizeBase):
      """
      Returns activation post process module which is same as module but with
      affine qscheme.
      """
      _common_observer_param_names = [
          "dtype",
          "qscheme",
          "reduce_range",
          "quant_min",
          "quant_max",
          "eps",
      ]
      _observer_type_to_param_names = {
          _aoquant.MinMaxObserver: list(_common_observer_param_names),
          _aoquant.PerChannelMinMaxObserver: list(
              _common_observer_param_names
          )
          + ["ch_axis"],
          _aoquant.MovingAverageMinMaxObserver: list(
              _common_observer_param_names
          )
          + ["averaging_constant"],
          _aoquant.MovingAveragePerChannelMinMaxObserver: list(
              _common_observer_param_names
          )
          + ["averaging_constant", "ch_axis"],
          _aoquant.HistogramObserver: [
              "bins",
              "upsample_rate",
              "dtype",
              "qscheme",
              "reduce_range",
              "eps",
          ],
          _aoquant.PlaceholderObserver: [
              "dtype",
              "quant_min",
              "quant_max",
              "custom_op_name",
          ],
          _aoquant.NoopObserver: ["dtype", "custom_op_name"],
          _aoquant.FixedQParamsObserver: [
              "scale",
              "zero_point",
              "dtype",
              "qscheme",
              "quant_min",
              "quant_max",
          ],
      }
  
      activation_post_process = module.activation_post_process
      if (
          type(activation_post_process)
          not in _observer_type_to_param_names
      ):
          raise ValueError(
              f"Found unrecognized observer type {type(activation_post_process)}."
          )
      observer_type = type(activation_post_process)
      observer_param_names = _observer_type_to_param_names[
          observer_type
      ]
      kwargs = {
          k: getattr(activation_post_process, k)
          for k in observer_param_names
      }
      if "qscheme" in kwargs:
          kwargs["qscheme"] = _torch.per_tensor_affine
      new_act_post_process = _aoquant.FakeQuantize(
          observer=observer_type, **kwargs
      )
      return new_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 1 for calling a global function with example usage: _get_affine_act_post_process(module) and returns: new_act_post_process