TF 2.0 is out! Get hands-on practice at TF World, Oct 28-31. Use code TF20 for 20% off select passes. Register now

tf.get_default_graph

View source on GitHub

Returns the default graph for the current thread.

Aliases:

  • tf.compat.v1.get_default_graph
tf.get_default_graph()

The returned graph will be the innermost graph on which a Graph.as_default() context has been entered, or a global default graph if none has been explicitly created.

NOTE: The default graph is a property of the current thread. If you create a new thread, and wish to use the default graph in that thread, you must explicitly add a with g.as_default(): in that thread's function.

Returns:

The default Graph being used in the current thread.