code: def test_accuracy(mnist_data, mnist_model, hls_model):
      x_train, y_train, x_test, y_test = mnist_data
      x_test, y_test = x_test[:1000], y_test[:1000]
      # model under test predictions and accuracy
      y_keras = mnist_model.predict(x_test)
      y_hls4ml = hls_model.predict(x_test)
  
      acc_keras = accuracy_score(
          np.argmax(y_test, axis=1), np.argmax(y_keras, axis=1)
      )
      acc_hls4ml = accuracy_score(
          np.argmax(y_test, axis=1), np.argmax(y_hls4ml, axis=1)
      )
      rel_diff = abs(acc_keras - acc_hls4ml) / acc_keras
  
      print(f"Accuracy keras:      {acc_keras}")
      print(f"Accuracy hls4ml:     {acc_hls4ml}")
      print(f"Relative difference: {rel_diff}")
  
      assert acc_keras > 0.92 and rel_diff < 0.01
  
file_path: hls4ml/test/pytest/test_cnn_mnist_qkeras.py
imports: from pathlib import Path
  import numpy
  import pytest
  import tensorflow
  from qkeras.utils import _add_supported_quantized_objects
  from sklearn.metrics import accuracy_score
  from tensorflow.keras.models import model_from_json
  import hls4ml
label_desc: Use image node_id 4 for calling a global function with example usage: test_accuracy(mnist_data, mnist_model, hls_model) without return types