(frozen_graph_filename, print_op=False)
return graph
load a graph from protocol buffer file
load a graph from protocol buffer file
load a graph from protocol buffer file
def load_frozen_graph(frozen_graph_filename, print_op=False):
  """load a graph from protocol buffer file"""
  # We load the protobuf file from the disk and parse it to retrieve the
  # unserialized graph_def
  with tf.gfile.GFile(frozen_graph_filename, "rb") as in_f:
    graph_def = tf.GraphDef()
    graph_def.ParseFromString(in_f.read())

  # Then, we import the graph_def into a new Graph and returns it
  with tf.Graph().as_default() as graph:  #pylint: disable=not-context-manager
    # The name var will prefix every op/nodes in your graph
    # Since we load everything in a new graph, this is not needed
    tf.import_graph_def(
        graph_def,
        input_map=None,
        return_elements=None,
        name="",
        op_dict=None,
        producer_op_list=None)
    if print_op:
      print_ops(graph, prefix='load_frozen_graph')
  return graph
def load_frozen_graph ( frozen_graph_filename , print_op = False ) : # We load the protobuf file from the disk and parse it to retrieve the # unserialized graph_def with tf . gfile . GFile ( frozen_graph_filename , "rb" ) as in_f : graph_def = tf . GraphDef ( ) graph_def . ParseFromString ( in_f . read ( ) ) # Then, we import the graph_def into a new Graph and returns it with tf . Graph ( ) . as_default ( ) as graph : #pylint: disable=not-context-manager # The name var will prefix every op/nodes in your graph # Since we load everything in a new graph, this is not needed tf . import_graph_def ( graph_def , input_map = None , return_elements = None , name = "" , op_dict = None , producer_op_list = None ) if print_op : print_ops ( graph , prefix = 'load_frozen_graph' ) return graph