code: def validate_tf_model(
      platform,
      device_type,
      model_file,
      input_file,
      mace_out_file,
      input_names,
      input_shapes,
      input_data_formats,
      output_names,
      output_shapes,
      output_data_formats,
      validation_threshold,
      input_data_types,
      output_data_types,
      log_file,
  ):
      import tensorflow as tf
  
      if not os.path.isfile(model_file):
          common.MaceLogger.error(
              VALIDATION_MODULE,
              "Input graph file '" + model_file + "' does not exist!",
          )
  
      tf.reset_default_graph()
      input_graph_def = tf.GraphDef()
      with open(model_file, "rb") as f:
          data = f.read()
          input_graph_def.ParseFromString(data)
          # delete explicit_paddings
          for node in input_graph_def.node:
              name = str(node.name).split("/")[-1]
              if name == "depthwise_Fold" or name == "depthwise":
                  if "explicit_paddings" in node.attr:
                      del node.attr["explicit_paddings"]
          tf.import_graph_def(input_graph_def, name="")
  
          with tf.Session() as session:
              with session.graph.as_default() as graph:
                  tf.import_graph_def(input_graph_def, name="")
                  input_dict = {}
                  for i in range(len(input_names)):
                      input_value = load_data(
                          common.formatted_file_name(
                              input_file, input_names[i]
                          ),
                          input_data_types[i],
                      )
                      input_value = input_value.reshape(input_shapes[i])
                      if (
                          input_data_formats[i]
                          == common.DataFormat.NCHW
                          and len(input_shapes[i]) == 4
                      ):
                          input_value = input_value.transpose(
                              (0, 2, 3, 1)
                          )
                      elif (
                          input_data_formats[i]
                          == common.DataFormat.OIHW
                          and len(input_shapes[i]) == 4
                      ):
                          # OIHW -> HWIO
                          input_value = input_value.transpose(
                              (2, 3, 1, 0)
                          )
                      input_node = graph.get_tensor_by_name(
                          normalize_tf_tensor_name(input_names[i])
                      )
                      input_dict[input_node] = input_value
  
                  output_nodes = []
                  for name in output_names:
                      output_nodes.extend(
                          [
                              graph.get_tensor_by_name(
                                  normalize_tf_tensor_name(name)
                              )
                          ]
                      )
                  output_values = session.run(
                      output_nodes, feed_dict=input_dict
                  )
                  for i in range(len(output_names)):
                      output_file_name = common.formatted_file_name(
                          mace_out_file, output_names[i]
                      )
                      mace_out_value = load_data(
                          output_file_name, output_data_types[i]
                      )
                      (
                          mace_out_value,
                          real_out_shape,
                          real_out_data_format,
                      ) = get_real_out_value_shape_df(
                          platform,
                          mace_out_value,
                          output_shapes[i],
                          output_data_formats[i],
                      )
                      compare_output(
                          platform,
                          device_type,
                          output_names[i],
                          mace_out_value,
                          output_values[i],
                          validation_threshold,
                          log_file,
                          real_out_shape,
                          real_out_data_format,
                      )
  
imports: import argparse
  import sys
  import os
  import os.path
  import numpy
  import six
  import common
label_desc: Use image node_id 9 for calling a global function with example usage: validate_tf_model(platform, device_type, model_file, input_file, mace_out_file, input_names, input_shapes, input_data_formats, output_names, output_shapes, output_data_formats, validation_threshold, input_data_types, output_data_types, log_file) without return types