code: def test_convert_from_frozen_graph_file(tmpdir, backend):
      # create the model to convert
  
      # write a toy frozen graph
      # Note that we usually needs to run freeze_graph() on tf.Graph()
      # skipping here as this toy model does not contain any variables
      with tf.Graph().as_default() as graph:
          x = tf.placeholder(tf.float32, shape=(1, 2, 3), name="input")
          y = tf.nn.relu(x, name="output")
  
      save_path = str(tmpdir)
      tf.io.write_graph(
          graph, save_path, "frozen_graph.pb", as_text=False
      )
  
      # Create a test sample
      # -0.5 to have some negative values
      test_input = np.random.rand(1, 2, 3) - 0.5
      with tf.compat.v1.Session(graph=graph) as sess:
          expected_val = sess.run(y, feed_dict={x: test_input})
  
      # The input `.pb` file is a frozen graph format that usually
      # generated by TensorFlow's utility function `freeze_graph()`
      pb_path = os.path.join(save_path, "frozen_graph.pb")
  
      # 3 ways to specify inputs:
      # (1) Fully specify inputs
      mlmodel = ct.convert(
          pb_path,
          # We specify inputs with name matching the placeholder name.
          inputs=[ct.TensorType(name="input", shape=(1, 2, 3))],
          outputs=["output"],
          convert_to=backend[0],
      )
  
      # (2) Specify input TensorType without name (when there's only one
      # input)
      mlmodel = ct.convert(
          pb_path,
          # TensorType name is optional when there's only one input.
          inputs=[ct.TensorType(shape=(1, 2, 3))],
          outputs=["output"],
          convert_to=backend[0],
      )
  
      # (3) Not specify inputs at all. `inputs` is optional for TF. When
      # inputs is not specified, convert() infers inputs from Placeholder
      # nodes.
      mlmodel = ct.convert(
          pb_path,
          outputs=["output"],
          convert_to=backend[0],
          compute_units=ct.ComputeUnit.CPU_ONLY,
      )
  
      results = mlmodel.predict({"input": test_input})
      np.testing.assert_allclose(results["output"], expected_val)
      suffix = (
          ".mlmodel" if backend[0] == "neuralnetwork" else ".mlpackage"
      )
      mlmodel_path = os.path.join(save_path, "model" + suffix)
      # Save the converted model
      mlmodel.save(mlmodel_path)
  
      results = mlmodel.predict({"input": test_input})
      np.testing.assert_allclose(
          results["output"], expected_val, atol=1e-3
      )
  
imports: import itertools
  import os
  import tempfile
  import numpy
  import pytest
  import coremltools
  from coremltools._deps import _HAS_TF_1, _HAS_TF_2, MSG_TF1_NOT_FOUND
  from coremltools.converters.mil.testing_reqs import backends, compute_units
  from coremltools.converters.mil.testing_utils import assert_cast_ops_count, assert_input_dtype, assert_ops_in_mil_program, assert_output_dtype, assert_prog_input_type, assert_prog_output_type, assert_spec_input_image_type, assert_spec_output_image_type, get_op_types_in_program, verify_prediction
  from coremltools.proto import FeatureTypes_pb2
  from coremltools.test.api.test_api_examples import TestInputs
label_desc: Use image node_id 2 for calling the TestTensorFlow1ConverterExamples obj's underlying member method code with example usage: obj.test_convert_from_frozen_graph_file(tmpdir, backend) without return types