Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # load checkpoint or saved_model
- restorer = tf.train.import_meta_graph('./model.meta')
- graph = tf.get_default_graph()
- graph.as_default()
- #print node names
- print_nodes_name(graph)
- # cut it after the first layer
- nodes_to_conserve = ['model/conv1/Relu']
- # extract subgraph
- subgraph = tf.graph_util.extract_sub_graph(graph.as_graph_def(), nodes_to_conserve)
- # for the second time
- print_nodes_name(graph)
- with tf.Session(graph=tf.graph_util.import_graph_def(subgraph)) as sess:
- ...
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement