code: def save(self, path, model_format):
      if model_format == "savedmodel":
          logging.info("Creating a SavedModel.")
  
          builder = tf.compat.v1.saved_model.builder.SavedModelBuilder(
              path
          )
          freezing_graph = self.model.sess.graph
          builder.add_meta_graph_and_variables(
              self.model.sess,
              ["serve"],
              signature_def_map={
                  "serving_default": tf.compat.v1.saved_model.signature_def_utils.predict_signature_def(
                      {
                          "input": freezing_graph.get_tensor_by_name(
                              "input_image_as_bytes:0"
                          )
                      },
                      {
                          "output": freezing_graph.get_tensor_by_name(
                              "prediction:0"
                          ),
                          "probability": freezing_graph.get_tensor_by_name(
                              "probability:0"
                          ),
                      },
                  ),
              },
              clear_devices=True,
          )
          builder.save()
  
          logging.info("Exported SavedModel into %s", path)
  
      elif model_format == "frozengraph":
          logging.info("Creating a frozen graph.")
  
          if not os.path.exists(path):
              os.makedirs(path)
  
          output_graph_def = (
              tf.compat.v1.graph_util.convert_variables_to_constants(
                  self.model.sess,
                  self.model.sess.graph.as_graph_def(),
                  ["prediction", "probability"],
              )
          )
  
          with tf.io.gfile.GFile(
              path + "/frozen_graph.pb", "wb"
          ) as outfile:
              outfile.write(output_graph_def.SerializeToString())
  
          logging.info("Exported as %s", path + "/frozen_graph.pb")
  
file_path: attention-ocr/aocr/util/export.py
imports: from __future__ import absolute_import
  import os
  import logging
  import tensorflow
label_desc: Use image node_id 2 for calling the Exporter obj's underlying member method code with example usage: obj.save(path, model_format) without return types