MCPcopy Create free account
hub / github.com/cloud-annotations/cloud-annotations / optimize_graph

Function optimize_graph

scripts/convert_ssd_helper.py:19–31  ·  view source on GitHub ↗
(input_path, output_path, input_nodes, output_nodes)

Source from the content-addressed store, hash-verified

17
18
19def optimize_graph(input_path, output_path, input_nodes, output_nodes):
20 graph = tf.Graph()
21 with tf.Session(graph=graph) as sess:
22 tf.saved_model.loader.load(sess, [tf.saved_model.tag_constants.SERVING], input_path)
23
24 gdef = strip_unused_lib.strip_unused(
25 input_graph_def=graph.as_graph_def(),
26 input_node_names=input_nodes,
27 output_node_names=output_nodes,
28 placeholder_type_enum=dtypes.float32.as_datatype_enum)
29 with gfile.GFile(output_path, 'wb') as f:
30 f.write(gdef.SerializeToString())
31 return graph
32
33
34def convert_ssd(exported_graph_path, model_structure, output_path):

Callers 1

convert_ssdFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected