code: def freeze_graph(sess, input_tensors, output_tensors):
      """Returns a frozen GraphDef.
  
      Runs a Grappler pass and freezes a graph with Variables in it. Otherwise the
      existing GraphDef is returned. The Grappler pass is only run on models that
      are frozen in order to inline the functions in the graph.
      If OpHints is present, it will try to convert the OpHint graph.
  
      Args:
        sess: TensorFlow Session.
        input_tensors: List of input tensors.
        output_tensors: List of output tensors (only .name is used from this).
  
      Returns:
        Frozen GraphDef.
      """
      # Runs a Grappler pass in order to inline any functions in the graph.
      # Asides from inlining any simple function, Grappler will also try to lower
      # while loop into switch merge representation which is undesired for Ophints,
      # so we simply remove those attributes to prevent Grappler from doing so.
      graph_def = (
          _convert_to_constants.disable_lower_using_switch_merge(
              sess.graph_def
          )
      )
      config = get_grappler_config(["function"])
      graph_def = run_graph_optimizations(
          graph_def,
          input_tensors,
          output_tensors,
          config,
          graph=sess.graph,
      )
  
      # If ophints are present, just convert them.
      hinted_outputs_nodes = find_all_hinted_output_nodes(sess)
      if hinted_outputs_nodes:
          return _convert_op_hints_if_present(
              sess, graph_def, output_tensors, hinted_outputs_nodes
          )
  
      if not is_frozen_graph(sess):
          output_node_names = [
              tensor.name.split(":")[0] for tensor in output_tensors
          ]
          return _convert_to_constants.convert_variables_to_constants(
              sess, graph_def, output_node_names
          )
      else:
          return sess.graph_def
  
imports: import copy
  import datetime
  import sys
  from absl import logging
  import flatbuffers
  from tensorflow.core.protobuf import config_pb2
  from tensorflow.core.protobuf import meta_graph_pb2
  from tensorflow.lite.python import conversion_metadata_schema_py_generated
  from tensorflow.lite.python import schema_py_generated
  from tensorflow.lite.python import schema_util
  from tensorflow.lite.python import tflite_keras_util
  from tensorflow.lite.python.op_hint import convert_op_hints_to_stubs
  from tensorflow.lite.python.op_hint import find_all_hinted_output_nodes
  from tensorflow.lite.tools import flatbuffer_utils
  from tensorflow.python.eager import function
  from tensorflow.python.framework import convert_to_constants
  from tensorflow.python.framework import dtypes
  from tensorflow.python.framework import error_interpolation
  from tensorflow.python.grappler import tf_optimizer
  from tensorflow.python.training.saver import export_meta_graph
label_desc: Use image node_id 9 for calling a global function with example usage: freeze_graph(sess, input_tensors, output_tensors) and returns: _convert_op_hints_if_present, _convert_to_constants, sess