code: def ckpt_to_frozen_graph(options):
      with tf.gfile.GFile(options.pbPath, "rb") as f:
          graph_def = tf.GraphDef()
          graph_def.ParseFromString(f.read())
  
          var_list_name = [
              node.name + ":0"
              for node in graph_def.node
              if node.op in ["Variable", "VariableV2", "VarHandleOp"]
          ]
  
      # now build the graph in the memory and visualize it
      with tf.Session() as sess:
          graph = tf.get_default_graph()
          tf.import_graph_def(graph_def, name="")
  
          var_list = [
              graph.get_tensor_by_name(name) for name in var_list_name
          ]
  
          for v in var_list:
              tf.add_to_collection(tf.GraphKeys.TRAINABLE_VARIABLES, v)
  
          saver = tf.train.Saver(var_list)
          saver.restore(sess, options.ckptPath)
  
          input_names = options.inputsName.split(",")
          output_names = options.outputsName.split(",")
  
          input_tensors = [
              graph.get_tensor_by_name(name) for name in input_names
          ]
          output_tensors = [
              graph.get_tensor_by_name(name) for name in output_names
          ]
  
          export_tf(
              sess,
              options.outputDir,
              inputs=input_tensors,
              outputs=output_tensors,
          )
  
imports: import tensorflow
  from bigdl.dllib.utils.tf import export_tf
  from optparse import OptionParser
  from bigdl.dllib.utils.log4Error import *
label_desc: Use image node_id 1 for calling a global function with example usage: ckpt_to_frozen_graph(options) without return types