docstr: Wrap an module to enable data parallel, forward method customization and buffer registeration.
  
  Parameters
  ----------
  module : pytorch module
      the module user wants to compress
  config : dict
      the configurations that users specify for compression
  module_name : str
      the name of the module to compress, wrapper module shares same name
  module_type : str
      the type of the module to compress
  quantizer ：quantizer
      the quantizer used to calculate mask
docstr_tok: ["Wrap","an","module","to","enable","data","parallel",",","forward","method","customization","and","buffer","registeration",".","Parameters","--","--","--","--","--","module",":","pytorch","module","the","module","user","wants","to","compress","config",":","dict","the","configurations","that","users","specify","for","compression","module_name",":","str","the","name","of","the","module","to","compress",",","wrapper","module","shares","same","name","module_type",":","str","the","type","of","the","module","to","compress","quantizer","\uff1aquantizer","the","quantizer","used","to","calculate","mask"]
code: def __init__(
      self, module, module_name, module_type, config, quantizer
  ):
      """
      Wrap an module to enable data parallel, forward method customization and buffer registeration.
  
      Parameters
      ----------
      module : pytorch module
          the module user wants to compress
      config : dict
          the configurations that users specify for compression
      module_name : str
          the name of the module to compress, wrapper module shares same name
      module_type : str
          the type of the module to compress
      quantizer ：quantizer
          the quantizer used to calculate mask
      """
      super().__init__()
      # origin layer information
      self.module = module
      self.name = module_name
      self.type = module_type
      # config and pruner
      self.config = config
      self.quantizer = quantizer
  
      # register buffer and parameter
      # old_weight is used to store origin weight and weight is used to store quantized weight
      # the reason why weight is buffer instead of parameter is because in pytorch parameter is used as leaf
      # if weight is leaf , then old_weight can not be updated.
      if "weight" in config["quant_types"]:
          if not _check_weight(self.module):
              _logger.warning(
                  'Module %s does not have parameter "weight"',
                  self.name,
              )
          else:
              self.module.register_parameter(
                  "old_weight", torch.nn.Parameter(self.module.weight)
              )
              delattr(self.module, "weight")
              self.module.register_buffer(
                  "weight", self.module.old_weight
              )
  
imports: import types
  import logging
  import torch
  from .None import default_layers
label_desc: Use image node_id 1 to create a new QuantizerModuleWrapper object from inherited base classes: torch.nn with example: obj = QuantizerModuleWrapper(module, module_name, module_type, config, quantizer)