code: def convert(
      checkpoint_meta_file: str,
      frozen: bool = False,
      output_nodes: List[str] = (),
  ) -> tf.GraphDef:
      """Convert TF Checkpoint to ProtoBuf
  
      Args:
          checkpoint_meta_file (str): checkpoint meta file name
          frozen (bool, optional): to create a frozen graphdef. Defaults to False.
          output_nodes (List[str], optional): A list of output node names for frozen graph. Defaults to ().
  
      Returns:
          tf.GraphDef: Tensorflow Graph to be written to file
  
      """
      model_dir = path.dirname(checkpoint_meta_file)
      ckpt = tf.train.get_checkpoint_state(model_dir)
      g = tf.Graph()
      with g.as_default():
          saver = tf.train.import_meta_graph(
              ckpt.model_checkpoint_path + ".meta", clear_devices=True
          )
          input_graph_def = g.as_graph_def()
      with tf.Session(graph=g) as sess:
          saver.restore(sess, ckpt.model_checkpoint_path)
          if frozen:
              input_graph_def = to_frozen(sess, output_nodes)
      return input_graph_def
  
file_path: auptimizer/src/aup/dlconvert/checkpoint_to_pb.py
imports: from os import path
  from typing import List
  import tensorflow.compat.v1
  from absl import flags, app
  from .utils import reset_flag
  from .to_frozen_pb import to_frozen
label_desc: Use image node_id 1 for calling a global function with example usage: convert(checkpoint_meta_file, frozen, output_nodes) and returns: input_graph_def