Advertisement
Guest User

Untitled

a guest
Jun 27th, 2019
79
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.48 KB | None | 0 0
  1. # load checkpoint or saved_model
  2. restorer = tf.train.import_meta_graph('./model.meta')
  3. graph = tf.get_default_graph()
  4. graph.as_default()
  5.  
  6. #print node names
  7. print_nodes_name(graph)
  8.  
  9. # cut it after the first layer
  10. nodes_to_conserve = ['model/conv1/Relu']
  11.  
  12. # extract subgraph
  13. subgraph = tf.graph_util.extract_sub_graph(graph.as_graph_def(), nodes_to_conserve)
  14.  
  15. # for the second time
  16. print_nodes_name(graph)
  17.  
  18. with tf.Session(graph=tf.graph_util.import_graph_def(subgraph)) as sess:
  19. ...
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement