Re:Keras vs PyTorch
by candiodari on Thursday June 28, 2018 @07:53AM
(#17416086)
> dump and freeze Keras' Tensorflow graphs
You can get a direct reference to the graphs if you want, that will let you do anything tensorflow lets you do. I think this is what you want:
# This assumes your model is ready to be called with .predict()
sess = keras.get_session()
graph = sess.graph
graph_dev = graph.as_graph_def()
frozen_graph = tf.graph_util.convert_variables_to_constants(
sess, graph_def, nodes_to_output)
encoded_frozen_graph = frozen_graph.SerializeToString()
You can get a direct reference to the graphs if you want, that will let you do anything tensorflow lets you do. I think this is what you want: