tf.compat.v1.get_default_graph  |  TensorFlow v2.16.1 (original) (raw)

tf.compat.v1.get_default_graph

Stay organized with collections Save and categorize content based on your preferences.

Returns the default graph for the current thread.

tf.compat.v1.get_default_graph() -> tf.Graph

Migrate to TF2

get_default_graph does not work with either eager execution ortf.function, and you should not invoke it directly. To migrate code that uses Graph-related functions to TF2, rewrite the code without them. See themigration guide for more description about the behavior and semantic changes between Tensorflow 1 and Tensorflow 2.

Description

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

Returns
The default Graph being used in the current thread.

Except as otherwise noted, the content of this page is licensed under the Creative Commons Attribution 4.0 License, and code samples are licensed under the Apache 2.0 License. For details, see the Google Developers Site Policies. Java is a registered trademark of Oracle and/or its affiliates. Some content is licensed under the numpy license.

Last updated 2024-04-26 UTC.