class_docstr: A custom torch dispatch mode to calibrate quantized modules.
  
  In order to improve the accuracy of the quantized activations, the input and output
  scales of each quantized module are evaluated per-batch using the absmax algorithm and aggregated using a
  momentum.
  
  The dispatch mode also tracks the calls to each torch function down the model graph, and applies optional
  optimizations:
  - streamline: do not quantize activations that are immediately consumed by an incompatible function (like `add` or `silu`).
  
  Args:
      momentum (`float`): the momentum to use when updating scales.
      streamline (`bool`): if True, avoid quantizing activations when they are consumed by an incompatible function. Defaults to True.
      debug (`bool`): provide very verbose feedback on the console during calibration.
code: def __init__(
      self,
      *args,
      momentum: float = 0.9,
      streamline=True,
      debug=False,
      **kwargs,
  ):
      super().__init__(*args, **kwargs)
      self.momentum = momentum
      self.streamline = streamline
      if streamline:
          self.modules_qactivations = {}
      self.debug = debug
  
file_path: quanto/quanto/calibrate.py
imports: import torch
  from torch.nn.modules.module import register_module_forward_hook, register_module_forward_pre_hook
  from torch.overrides import TorchFunctionMode
  from .nn import QModuleMixin
  from .tensor import QTensor, absmax_scale
label_desc: Use image node_id 1 to create a new Calibration object from inherited base classes: TorchFunctionMode with example: obj = Calibration()