class_docstr: A DoFn that loads tflite models and predicts.
class_docstr_tok: ["A","DoFn","that","loads","tflite","models","and","predicts","."]
docstr: Performs quantization according to the spec: http://shortn/_QPyWQx5mhW.
docstr_tok: ["Performs","quantization","according","to","the","spec",":","http",":","\/\/shortn\/_QPyWQx5mhW","."]
code: def _quantize(
      self,
      tensor: np.ndarray,
      scale: np.ndarray,
      zero_point: np.ndarray,
      dtype: np.dtype,
  ) -> np.ndarray:
      """Performs quantization according to the spec: http://shortn/_QPyWQx5mhW."""
      if scale.size == 0 or zero_point.size == 0:
          return tensor
      return (tensor / scale + zero_point).astype(dtype)
  
imports: import collections
  import copy
  from typing import Callable, Dict, Sequence, Union
  from absl import logging
  import apache_beam
  import numpy
  import tensorflow
  from tensorflow_model_analysis import constants
  from tensorflow_model_analysis.api import types
  from tensorflow_model_analysis.extractors import extractor
  from tensorflow_model_analysis.proto import config_pb2
  from tensorflow_model_analysis.utils import model_util
  from tensorflow_model_analysis.utils import util
label_desc: Use image node_id 6 for calling the TFLitePredictionDoFn obj's underlying member method code with example usage: obj._quantize(tensor, scale, zero_point, dtype) and returns: unknown, tensor