class_docstr: Implementation of Dynamic Quantization for PyTorch models.
  
  :param model: Model that needs to be quantized
  :type model: torch.nn.Module
  :param qconfig_spec: Qconfig spec
  :type qconfig_spec: Qconfig_spec
  :param test_loader: DataLoader used for testing
  :type test_loader: torch.utils.data.DataLoader
class_docstr_tok: ["Implementation","of","Dynamic","Quantization","for","PyTorch","models",".",":","param","model",":","Model","that","needs","to","be","quantized",":","type","model",":","torch.nn.Module",":","param","qconfig_spec",":","Qconfig","spec",":","type","qconfig_spec",":","Qconfig_spec",":","param","test_loader",":","DataLoader","used","for","testing",":","type","test_loader",":","torch.utils.data.DataLoader"]
docstr: Function used for quantization
  
  :param dtype: dtype for quantized modules
  :type dtype: torch.dtype
  :param mapping: maps type of a submodule to a type of corresponding dynamically quantized version with which the submodule needs to be replaced
  :type mapping: mapping
docstr_tok: ["Function","used","for","quantization",":","param","dtype",":","dtype","for","quantized","modules",":","type","dtype",":","torch.dtype",":","param","mapping",":","maps","type","of","a","submodule","to","a","type","of","corresponding","dynamically","quantized","version","with","which","the","submodule","needs","to","be","replaced",":","type","mapping",":","mapping"]
code: def quantize(self, dtype=torch.qint8, mapping=None):
      """
      Function used for quantization
  
      :param dtype: dtype for quantized modules
      :type dtype: torch.dtype
      :param mapping: maps type of a submodule to a type of corresponding dynamically quantized version with which the submodule needs to be replaced
      :type mapping: mapping
      """
  
      self.quantized_model = torch.quantization.quantize_dynamic(
          self.model,
          qconfig_spec=self.qconfig,
          dtype=dtype,
          mapping=mapping,
          inplace=False,
      )
      return self.quantized_model
  
imports: import torch
  from KD_Lib.Quantization.common import Quantizer
label_desc: Use image node_id 2 for calling the Dynamic_Quantizer obj's underlying member method code with example usage: obj.quantize(dtype, mapping) and returns: self