code: def quantize(data, device, non_zero):
      np_data = np.array(data).astype(float)
      in_min = np_data.min()
      in_max = np_data.max()
      scale, zero, out_min, out_max = adjust_range(
          in_min, in_max, device, non_zero=non_zero
      )
      output = np.clip(
          (np.round(zero + np_data / scale).astype(np.int32)), 0, 255
      )
  
      quantized_data = QuantizedData()
      quantized_data.data = output
      quantized_data.scale = scale
      quantized_data.zero = zero
      quantized_data.minval = out_min
      quantized_data.maxval = out_max
      return quantized_data
  
imports: from __future__ import absolute_import
  from __future__ import division
  from __future__ import print_function
  import numpy
  import math
  from transform.base_converter import DeviceType
label_desc: Use image node_id 9 for calling a global function with example usage: quantize(data, device, non_zero) and returns: quantized_data