code: def update_quantization_param(bits, rmin, rmax):
      """
      calculate the `zero_point` and `scale`.
  
      Parameters
      ----------
      bits : int
          quantization bits length
      rmin : Tensor
          min value of real value
      rmax : Tensor
          max value of real value
  
      Returns
      -------
      float, float
      """
      # extend the [min, max] interval to ensure that it contains 0.
      # Otherwise, we would not meet the requirement that 0 be an exactly
      # representable value.
      rmin = torch.min(rmin, torch.Tensor([0]).to(rmin.device))
      rmax = torch.max(rmax, torch.Tensor([0]).to(rmin.device))
      qmin = torch.Tensor([0]).to(rmin.device)
      qmax = torch.Tensor([(1 << bits) - 1]).to(rmin.device)
  
      # First determine the scale.
      scale = (rmax - rmin) / (qmax - qmin)
  
      # Zero-point computation.
      initial_zero_point = qmin - rmin / scale
  
      # Now we need to nudge the zero point to be an integer
      if initial_zero_point < qmin:
          nudged_zero_point = qmin
      elif initial_zero_point > qmax:
          nudged_zero_point = qmax
      else:
          nudged_zero_point = torch.round(initial_zero_point)
  
      return scale, nudged_zero_point
  
imports: import logging
  import copy
  import torch
  from schema import Schema, And, Or, Optional
  from ..utils.config_validation import CompressorSchema
  from ..compressor import Quantizer, QuantGrad, QuantType
label_desc: Use image node_id 2 for calling a global function with example usage: update_quantization_param(bits, rmin, rmax) and returns: scale,  nudged_zero_point