code: def quantize_int8(data):
      np_data = np.array(data).astype(float)
      in_min = np_data.min()
      in_max = np_data.max()
  
      in_min = min(0.0, in_min)
      in_max = max(0.0, in_max)
      max_abs = max(abs(in_min), abs(in_max))
      zero = 0
      scale = max_abs / 127
  
      output = np.clip(
          (np.round(zero + np_data / scale).astype(np.int32)), -127, 127
      )
  
      quantized_data = QuantizedData()
      quantized_data.data = output
      quantized_data.scale = scale
      quantized_data.zero = zero
      quantized_data.minval = -127 * scale
      quantized_data.maxval = 127 * scale
      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 7 for calling a global function with example usage: quantize_int8(data) and returns: quantized_data