(saved_model_dir,
                                        sess_config,
                                        print_op=False)
return graph, sess
Load graph session from SavedModel
Load graph session from SavedModel
Load graph session from SavedModel
def load_graph_session_from_saved_model(saved_model_dir,
                                        sess_config,
                                        print_op=False):
  """Load graph session from SavedModel"""
  if not tf.saved_model.maybe_saved_model_directory(saved_model_dir):
    raise ValueError("Not a saved model dir: {}".format(saved_model_dir))

  logging.info('saved model dir : {}'.format(saved_model_dir))
  graph = tf.Graph()
  with graph.as_default():  #pylint: disable=not-context-manager
    sess = get_session(sess_config)
    with sess.as_default():  #pylint: disable=not-context-manager
      tf.saved_model.loader.load(sess, [tf.saved_model.tag_constants.SERVING],
                                 saved_model_dir)
      if print_op:
        print_ops(graph, prefix='load_graph_session_from_saved_model')
  return graph, sess
def load_graph_session_from_saved_model ( saved_model_dir , sess_config , print_op = False ) : if not tf . saved_model . maybe_saved_model_directory ( saved_model_dir ) : raise ValueError ( "Not a saved model dir: {}" . format ( saved_model_dir ) ) logging . info ( 'saved model dir : {}' . format ( saved_model_dir ) ) graph = tf . Graph ( ) with graph . as_default ( ) : #pylint: disable=not-context-manager sess = get_session ( sess_config ) with sess . as_default ( ) : #pylint: disable=not-context-manager tf . saved_model . loader . load ( sess , [ tf . saved_model . tag_constants . SERVING ] , saved_model_dir ) if print_op : print_ops ( graph , prefix = 'load_graph_session_from_saved_model' ) return graph , sess