code: def add_quant_dequant(module):
      r"""Wrap the leaf child module in QuantWrapper if it has a valid qconfig
      Note that this function will modify the children of module inplace and it
      can return a new module which wraps the input module as well.
  
      Args:
          module: input module with qconfig attributes for all the leaf modules
          that we want to quantize
  
      Return:
          Either the inplace modified module with submodules wrapped in
          `QuantWrapper` based on qconfig or a new `QuantWrapper` module which
          wraps the input module, the latter case only happens when the input
          module is a leaf module and we want to quantize it.
      """
      if (
          has_no_children_ignoring_parametrizations(module)
          and hasattr(module, "qconfig")
          and module.qconfig
      ):
          return QuantWrapper(module)
  
      for name, child in module.named_children():
          module._modules[name] = add_quant_dequant(child)
      return module
  
imports: import copy
  import itertools
  import warnings
  import torch
  import torch.nn
  import torch.ao.nn.quantized
  from torch.ao.nn.intrinsic import _FusedModule
  from torch.ao.quantization.quantization_mappings import get_default_dynamic_quant_module_mappings, get_default_static_quant_module_mappings, get_default_static_quant_reference_module_mappings, get_default_qat_module_mappings, get_default_qconfig_propagation_list, no_observer_set, _has_special_act_post_process, _get_special_act_post_process
  from .utils import get_qparam_dict, has_no_children_ignoring_parametrizations
  from torch.ao.quantization.stubs import DeQuantStub, QuantWrapper
  from torch.ao.quantization.qconfig import _add_module_to_qconfig_obs_ctr, default_dynamic_qconfig, float16_dynamic_qconfig, float_qparams_weight_only_qconfig, float_qparams_weight_only_qconfig_4bit, _activation_is_memoryless
  from torch.nn.utils.parametrize import type_before_parametrizations
  from torch.ao.quantization.observer import _is_activation_post_process
  from torch.ao.quantization.observer import _is_activation_post_process
label_desc: Use image node_id 9 for calling a global function with example usage: add_quant_dequant(module) and returns: module, QuantWrapper