code: def update_scale_zp(
      self, wrapper: ModuleWrapper, target_name: str, target: Tensor
  ) -> None:
      if not self.check_target(wrapper, target_name):
          return
      target_space = wrapper.quantization_target_spaces[target_name]
      if target_space.type is not TargetType.INPUT:
          return
      # track min max values
      current_amin = target.detach().reshape(-1).amin(-1)
      current_amax = target.detach().reshape(-1).amax(-1)
      # update scale and zero_point
      tracked_min = torch.min(
          current_amin, torch.zeros_like(current_amin)
      )
      tracked_max = torch.max(
          current_amax, torch.zeros_like(current_amax)
      )
      zero_point = torch.zeros_like(tracked_min)
      qmin, qmax = target_space.qmin, target_space.qmax
      assert isinstance(qmin, int) and isinstance(qmax, int)
      if target_space.quant_scheme in ["symmetric", None]:
          abs_max = torch.max(
              torch.abs(tracked_min), torch.abs(tracked_max)
          )
          scale = abs_max / (float(qmax - qmin) / 2)
          scale = torch.max(
              scale,
              torch.full_like(scale, torch.finfo(torch.float32).eps),
          )
          # NOTE: here need to check, +1 because in pytorch, symmetric qint8 zp is 0, quint8 zp is 128.
          zero_point_val = (qmax + qmin + 1) // 2
          zero_point = torch.full_like(zero_point, zero_point_val)
      elif target_space.quant_scheme == "affine":
          scale = (tracked_max - tracked_min) / float(qmax - qmin)
          scale = torch.max(
              scale,
              torch.full_like(scale, torch.finfo(torch.float32).eps),
          )
          zero_point = qmin - torch.round(tracked_min / scale)
      else:
          raise RuntimeError(
              f"Unknown quant_scheme {target_space.quant_scheme}"
          )
      zero_point = torch.clamp(zero_point, qmin, qmax)
      target_space.scale, target_space.zero_point = scale, zero_point
  
imports: from __future__ import annotations
  import logging
  from typing import List, Dict, Union, overload
  import torch
  import torch.nn
  from torch import Tensor
  from nni.common.version import torch_version_is_2
  from ..base.compressor import Compressor, Quantizer
  from ..base.wrapper import ModuleWrapper
  from ..utils import Evaluator, _EVALUATOR_DOCSTRING
  from ..base.target_space import TargetType, QuantizationTargetSpace
label_desc: Use image node_id 10 for calling the DoReFaQuantizer obj's underlying member method code with example usage: obj.update_scale_zp(wrapper, target_name, target) without return types