docstr: Common entry to testing routine (Tensors in, tensors out).
  tf_model_path - frozen TF model path
  coreml_model - MLModel object
  input_tensors -  list of (name,shape) for each input (placeholder)
  output_tensor_names - output_tensor_names, a list of strings
  sequence_inputs - dict of input names that are sequences for CoreML input
docstr_tok: ["Common","entry","to","testing","routine","(","Tensors","in",",","tensors","out",")",".","tf_model_path","-","frozen","TF","model","path","coreml_model","-","MLModel","object","input_tensors","-","list","of","(","name",",","shape",")","for","each","input","(","placeholder",")","output_tensor_names","-","output_tensor_names",",","a","list","of","strings","sequence_inputs","-","dict","of","input","names","that","are","sequences","for","CoreML","input"]
code: def _test_tf_model(
      self,
      tf_model_path,
      coreml_model,
      input_tensors,
      output_tensor_names,
      data_modes="random",
      delta=1e-2,
      use_cpu_only=False,
      scale=2.0 / 255,
      bias=-1,
      img_size=None,
      sequence_inputs=None,
  ):
      """Common entry to testing routine (Tensors in, tensors out).
      tf_model_path - frozen TF model path
      coreml_model - MLModel object
      input_tensors -  list of (name,shape) for each input (placeholder)
      output_tensor_names - output_tensor_names, a list of strings
      sequence_inputs - dict of input names that are sequences for CoreML input
      """
      # Load TensorFlow model
      tf.reset_default_graph()
      graph_def = graph_pb2.GraphDef()
      with open(tf_model_path, "rb") as f:
          graph_def.ParseFromString(f.read())
      g = tf.import_graph_def(graph_def)
  
      if type(data_modes) is str:
          data_modes = [data_modes] * len(input_tensors)
  
      with tf.Session(graph=g) as sess:
          # Prepare inputs
          feed_dict = {}
          for idx, in_tensor in enumerate(input_tensors):
              ts_name, ts_shape = in_tensor
              ts_name = "import/" + ts_name
              feed_dict[ts_name] = _generate_data(
                  ts_shape,
                  mode=data_modes[idx],
                  scale=scale,
                  bias=bias,
                  img_size=img_size,
              )
          # Run TF session
          out_tf_names = []
          for out_name in output_tensor_names:
              out_tf_names.append("import/" + out_name)
          result = sess.run(out_tf_names, feed_dict=feed_dict)
  
      # Evaluate coreml model
      coreml_inputs = {}
      for idx, in_tensor in enumerate(input_tensors):
          in_tensor_name, in_shape = in_tensor
          coreml_in_name = in_tensor_name.replace(":", "__").replace(
              "/", "__"
          )
          if in_tensor_name in sequence_inputs:
              coreml_inputs[coreml_in_name] = _tf_transpose(
                  feed_dict["import/" + in_tensor_name],
                  is_sequence=True,
              ).copy()
          else:
              coreml_inputs[coreml_in_name] = _tf_transpose(
                  feed_dict["import/" + in_tensor_name]
              ).copy()
  
      coreml_output = coreml_model.predict(
          coreml_inputs, useCPUOnly=use_cpu_only
      )
  
      for idx, out_name in enumerate(output_tensor_names):
          out_tensor_name = out_name.replace(":", "__").replace(
              "/", "__"
          )
          tp = _tf_transpose(result[idx]).flatten()
          cp = coreml_output[out_tensor_name].flatten()
          error, index = _compute_max_relative_error(tp, cp)
          snr, psnr = _compute_SNR(tp, cp)
          self._compare_tf_coreml_outputs(tp, cp)
  
imports: import unittest
  import urllib
  import os
  import tarfile
  import zipfile
  import numpy
  import PIL.Image
  import tensorflow
  from tensorflow.core.framework import graph_pb2
  import tfcoreml
label_desc: Use image node_id 3 for calling the CorrectnessTest obj's underlying member method code with example usage: obj._test_tf_model(tf_model_path, coreml_model, input_tensors, output_tensor_names, data_modes, delta, use_cpu_only, scale, bias, img_size, sequence_inputs) without return types