code: def _from_saved_model(saved_model_dir):
      from tensorflow.python.tools import freeze_graph
  
      # must import here as tf.contrib is only available on TF 1.x
      from tensorflow.contrib.saved_model.python.saved_model import (
          reader,
      )
  
      saved_model_tags = reader.get_saved_model_tag_sets(
          saved_model_dir
      )[0]
      if not saved_model_tags:
          msg = "Unsupported SavedModel directory format: no tag_sets available"
          raise NotImplementedError(msg)
  
      # get model outputs
      output_node_names = []
      if tf.__version__ < _StrictVersion("1.13.1"):
          sess = tf.Session()
      else:
          sess = tf.compat.v1.Session()
      metagraph = tf.saved_model.loader.load(
          sess, saved_model_tags, saved_model_dir
      )
      for sd in metagraph.signature_def.values():
          output_node_names += [
              o.name.split(":")[0] for o in sd.outputs.values()
          ]
  
      sess.close()
  
      # get frozen graph
      output_graph = mktemp()
      tf.compat.v1.reset_default_graph() if tf.__version__ >= _StrictVersion(
          "1.13.1"
      ) else tf.reset_default_graph()
      freeze_graph.freeze_graph(
          input_graph=None,
          input_saver=None,
          input_binary=None,
          input_checkpoint=None,
          output_node_names=",".join(output_node_names),
          restore_op_name=None,
          filename_tensor_name=None,
          output_graph=output_graph,
          clear_devices=True,
          initializer_nodes="",
          variable_names_whitelist="",
          variable_names_blacklist="",
          input_meta_graph=None,
          input_saved_model_dir=saved_model_dir,
          saved_model_tags=",".join(saved_model_tags),
      )
  
      if tf.__version__ < _StrictVersion("1.13.1"):
          graph_def = tf.GraphDef()
          with open(output_graph, "rb") as f:
              graph_def.ParseFromString(f.read())
          graph_def = tf.graph_util.remove_training_nodes(graph_def)
      else:
          graph_def = tf.compat.v1.GraphDef()
          with open(output_graph, "rb") as f:
              graph_def.ParseFromString(f.read())
          graph_def = tf.compat.v1.graph_util.remove_training_nodes(
              graph_def
          )
      with tf.Graph().as_default() as graph:
          tf.graph_util.import_graph_def(graph_def, name="")
      return graph.as_graph_def(add_shapes=True)
  
imports: from __future__ import absolute_import
  from __future__ import division
  from __future__ import print_function
  import logging
  import os
  import gc
  import six
  import tensorflow
  from tempfile import mktemp
  from .basic_graph_ops import fill_outputs
  from .converter import TFConverter
  from .tf_graph_pass import *
  from .tfssa import NetworkEnsemble, SSAFunction
  from .parsed_tf_node import ParsedTFNode
  from coremltools.converters._profile_utils import _profile
  from tqdm import tqdm
  from distutils.version import StrictVersion
label_desc: Use image node_id 5 for calling the TF1Loader obj's underlying member method code with example usage: obj._from_saved_model(saved_model_dir) and returns: graph