code: def eval_mnist_tflite(
      model_path=None, model_content=None, is_quantized=False
  ):
      """Evaluate mnist in TFLite for accuracy."""
      interpreter = tf.lite.Interpreter(
          model_path=model_path, model_content=model_content
      )
      interpreter.allocate_tensors()
      input_index = interpreter.get_input_details()[0]["index"]
      output_index = interpreter.get_output_details()[0]["index"]
  
      _, test_data, _ = get_preprocessed_mnist_data(
          is_quantized_model=is_quantized
      )
      x_test, y_test = test_data
  
      total_seen = 0
      num_correct = 0
  
      for img, label in zip(x_test, y_test):
          inp = img.reshape((1, 28, 28, 1))
          total_seen += 1
          interpreter.set_tensor(input_index, inp)
          interpreter.invoke()
          predictions = interpreter.get_tensor(output_index)
          if np.argmax(predictions) == np.argmax(label):
              num_correct += 1
  
          if total_seen % 1000 == 0:
              print(
                  "Accuracy after %i images: %f"
                  % (total_seen, float(num_correct) / float(total_seen))
              )
  
      return float(num_correct) / float(total_seen)
  
file_path: model-optimization/tensorflow_model_optimization/python/core/keras/test_utils.py
imports: import numpy
  import tensorflow
label_desc: Use image node_id 3 for calling a global function with example usage: eval_mnist_tflite(model_path, model_content, is_quantized) and returns: unknown