How do you get the name of the tensorflow output nodes in a Keras Model?

You can use Keras model.summary() to get the name of the last layer.

If model.outputs is not empty you can get the node names via:

[node.op.name for node in model.outputs]

you get the session via

session = keras.backend.get_session()

and you convert all training variables to consts via

min_graph = convert_variables_to_constants(session, session.graph_def, [node.op.name for node in model.outputs])

after that you can write a protobuf-file via

tensorflow.train.write_graph(min_graph, "/logdir/", "file.pb", as_text=True)

Leave a Comment

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)