code: def trace_model_and_compare_output(
      model, data_gen, ignore_data: List[str] = None
  ):
      # must turn on eval mode to ensure the output is consistent
      model.eval()
  
      inputs = data_gen()
  
      if ignore_data is not None:
          # drop the ignore_data key
          inputs = {
              k: v for k, v in inputs.items() if k not in ignore_data
          }
  
      try:
          meta_args = {k: v.to("meta") for k, v in inputs.items()}
          gm = symbolic_trace(model, meta_args=meta_args)
  
      except Exception as e:
          raise RuntimeError(
              f"Failed to trace {model.__class__.__name__}, error: {e}"
          )
  
      # run forward
      non_fx_out = model(**inputs)
      fx_out = gm(**inputs)
  
      # check output
      for k in non_fx_out.keys():
          if torch.is_tensor(fx_out[k]):
              assert torch.equal(
                  fx_out[k], non_fx_out[k]
              ), f"{model.__class__.__name__} has incorrect output {k}, expect {non_fx_out[k]}, but got {fx_out[k]}"
  
label_desc: Use image node_id 1 for calling a global function with example usage: trace_model_and_compare_output(model, data_gen, ignore_data) without return types