code: def evaluate_model(interpreter, test_images, test_labels):
      input_index = interpreter.get_input_details()[0]["index"]
      output_index = interpreter.get_output_details()[0]["index"]
  
      # Run predictions on every image in the "test" dataset.
      prediction_digits = []
      for i, test_image in enumerate(test_images):
          if i % 1000 == 0:
              print("Evaluated on {n} results so far.".format(n=i))
          # Pre-processing: add batch dimension and convert to float32 to match with
          # the model's input data format.
          test_image = np.expand_dims(test_image, axis=0).astype(
              np.float32
          )
          interpreter.set_tensor(input_index, test_image)
          # Run inference.
          interpreter.invoke()
          # Post-processing: remove batch dimension and find the digit with highest
          # probability.
          output = interpreter.tensor(output_index)
          digit = np.argmax(output()[0])
          prediction_digits.append(digit)
  
      print("\n")
      # Compare prediction results with ground truth labels to calculate accuracy.
      prediction_digits = np.array(prediction_digits)
      accuracy = (prediction_digits == test_labels).mean()
      return accuracy
  
file_path: model-optimization/tensorflow_model_optimization/python/examples/cluster_preserve_qat/keras/mnist_cnn.py
imports: from __future__ import print_function
  import os
  from absl import app
  import numpy
  import tensorflow
  from tensorflow_model_optimization.python.core.clustering.keras import cluster
  from tensorflow_model_optimization.python.core.clustering.keras import cluster_config
  from tensorflow_model_optimization.python.core.quantization.keras import quantize
  from tensorflow_model_optimization.python.core.quantization.keras.collab_opts.cluster_preserve import default_8bit_cluster_preserve_quantize_scheme
  from tensorflow_model_optimization.python.core.quantization.keras.collab_opts.cluster_preserve.cluster_utils import strip_clustering_cqat
label_desc: Use image node_id 8 for calling a global function with example usage: evaluate_model(interpreter, test_images, test_labels) and returns: accuracy