code: def convert(
      model: str, frozen: bool = False, output_nodes: List[str] = ()
  ) -> tf.compat.v1.GraphDef:
      """Convert Keras model to tensorflow graphdef
  
      Args:
          model (str): Keras model file name
          frozen (bool, optional): To frozen graphdef. Defaults to False.
          output_nodes (List[str], optional): output nodes, otherwise, use model outputs from Keras model. Defaults to ().
  
      Returns:
          tf.GraphDef: Tensorflow GraphDef
      """
      model = tf.keras.models.load_model(model)
      tf.compat.v1.keras.backend.set_learning_phase(0)
      if frozen:
          if not output_nodes:
              output_nodes = model.output.op.name
          sess = tf.compat.v1.keras.backend.get_session()
          protobuf = to_frozen(sess, output_nodes)
      else:
          protobuf = _to_graphdef()
      return protobuf
  
file_path: auptimizer/src/aup/dlconvert/keras_to_pb.py
imports: from os import path
  from typing import List
  from absl import flags, app
  import tensorflow
  from .utils import reset_flag
  from .to_frozen_pb import to_frozen
label_desc: Use image node_id 2 for calling a global function with example usage: convert(model, frozen, output_nodes) and returns: protobuf