code: def compare(keras_model, hls_model, X, plot_type="dist_diff"):
      """Compare each layer's output in keras and hls model. Note that the hls_model should not be compiled before using this.
  
      Args:
          keras_model: Original keras model.
          hls_model (ModelGraph): Converted ModelGraph, with "Trace:True" in the configuration file.
          X (ndarray): Input tensor for the model.
          plot_type (str, optional): Different methods to visualize the y_model and y_sim differences.
              Possible options include:
              - 'norm_diff':: square root of the sum of the squares of the differences between each output vectors.
              - 'dist_diff':: The normalized distribution of the differences of the elements between two output vectors.
              Defaults to "dist_diff".
  
      Returns:
          matplotlib figure: Plot object of the histogram depicting the difference in each layer's output.
      """
  
      # Take in output from both models
      # Note that each y is a dictionary with structure {"layer_name": flattened ouput array}
      ymodel = get_ymodel_keras(keras_model, X)
      _, ysim = hls_model.trace(X)
  
      print("Plotting difference...")
      f = plt.figure()
      if plot_type == "norm_diff":
          f = _norm_diff(ymodel, ysim)
      elif plot_type == "dist_diff":
          f = _dist_diff(ymodel, ysim)
  
      return f
  
imports: import json
  import os
  import shutil
  import uuid
  from collections import defaultdict
  import matplotlib.pyplot
  import numpy
  import pandas
  import seaborn
  from hls4ml.model.graph import ModelGraph
  from hls4ml.model.layers import GRU, LSTM, SeparableConv1D, SeparableConv2D
label_desc: Use image node_id 25 for calling a global function with example usage: compare(keras_model, hls_model, X, plot_type) and returns: f