parameters: (module)
return_statement: return module
docstring: 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.
docstring_summary: 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.
docstring_tokens: 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 .
function: 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 len(module._modules) == 0 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
function_tokens: def add_quant_dequant ( module ) : if len ( module . _modules ) == 0 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