# tf.get_default_graph

<br />

|---|
| [![](https://www.tensorflow.org/images/GitHub-Mark-32px.png) View source on GitHub](https://github.com/tensorflow/tensorflow/blob/v1.15.0/tensorflow/python/framework/ops.py#L5858-L5874) |

Returns the default graph for the current thread.

#### View aliases


**Compat aliases for migration**

See
[Migration guide](https://www.tensorflow.org/guide/migrate) for
more details.

[`tf.compat.v1.get_default_graph`](https://www.tensorflow.org/api_docs/python/tf/compat/v1/get_default_graph)

<br />

    tf.get_default_graph()

The returned graph will be the innermost graph on which a
[`Graph.as_default()`](https://www.tensorflow.org/versions/r1.15/api_docs/python/tf/Graph#as_default) context has been entered, or a global default
graph if none has been explicitly created.

> [!NOTE]
> **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.

<br />

<br />

<br />

| ## Returns ||
|---|---|
| The default `Graph` being used in the current thread. ||

<br />