class_docstr: To help replace torch.nn modules with quantized versions.
  
  This module is used to replace (by monkey patching) the torch.nn modules with their
  quantized versions as provided by either tool's internal implementation or any other
  user provided custom module.
  
  Attributes:
      orginal_func_map: A dict. Maintains the original torch.nn module mapping.
      quant_support_list: A list. Contains the names of modules for which a quantized
          version is provided by the tool.
      quant_map: A dict. Contains the map of the module name and its quantized versions.
      quant_switch_opt: A dict. A map to indicate which modules to be left unreplaced with
          their quantized versions. This dict is updated by a list provided from the user
          which indicates the modules to leave out in monkey patching.
docstr: Prepare the internal variables that would used in the monkey patching mechanism later.
  1. Set up the list of quantized modules that are supported by the tool for torch.nn.
  2. Set up the custom mapping for modules other than torch.nn.
  3. Use the float_module_list to switch off the monkey patching replacement for user indicated modules
docstr_tok: ["Prepare","the","internal","variables","that","would","used","in","the","monkey","patching","mechanism","later",".","1",".","Set","up","the","list","of","quantized","modules","that","are","supported","by","the","tool","for","torch.nn",".","2",".","Set","up","the","custom","mapping","for","modules","other","than","torch.nn",".","3",".","Use","the","float_module_list","to","switch","off","the","monkey","patching","replacement","for","user","indicated","modules"]
code: def prepare_state(self, float_module_list=None, custom_map=None):
      """
      Prepare the internal variables that would used in the monkey patching mechanism later.
      1. Set up the list of quantized modules that are supported by the tool for torch.nn.
      2. Set up the custom mapping for modules other than torch.nn.
      3. Use the float_module_list to switch off the monkey patching replacement for user indicated modules
      """
  
      # For the default quantized modules supported, generate the quant_map
      for item in self.default_quant_map:
          if (
              float_module_list is not None
              and item.mod_name in float_module_list
          ):
              # Skip this module if this is present in the float_module_list
              continue
          else:
              # append the modules into the variable that will be used in monkey patching
              self.quant_map.add(item)
              # also store the original module to be used in reverse monkey patching
              self.orginal_func_map.add(
                  _quant_entry(
                      item.orig_mod,
                      item.mod_name,
                      getattr(item.orig_mod, item.mod_name),
                  )
              )
  
      # Add custom modules to the quant_map
      if custom_map is not None:
          for item in custom_map:
              # append the custom modules to the list that will be used in monkey patching
              # Note that we convert a tuple to a named tuple here
              self.quant_map.add(
                  _quant_entry(item[0], item[1], item[2])
              )
              # also store the original module in another list which will be used to reverse monkey patching
              self.orginal_func_map.add(
                  _quant_entry(
                      item[0], item[1], getattr(item[0], item[1])
                  )
              )
  
file_path: lightseq/lightseq/training/pytorch_quantization/quant_modules.py
imports: from collections import namedtuple
  import torch
  from lightseq.training.pytorch_quantization import nn
label_desc: Use image node_id 2 for calling the QuantModuleReplacementHelper obj's underlying member method code with example usage: obj.prepare_state(float_module_list, custom_map) without return types