close

[Solved] AttributeError: module ‘tensorflow’ has no attribute ‘reset_default_graph’

Hello Guys, How are you all? Hope You all Are Fine. Today I get the following error AttributeError: module ‘tensorflow’ has no attribute ‘reset_default_graph’ in python. So Here I am Explain to you all the possible solutions here.

Without wasting your time, Let’s start This Article to Solve This Error.

How AttributeError: module ‘tensorflow’ has no attribute ‘reset_default_graph’ Error Occurs?

Today I get the following error AttributeError: module ‘tensorflow’ has no attribute ‘reset_default_graph’ in python.

How To Solve AttributeError: module ‘tensorflow’ has no attribute ‘reset_default_graph’ Error ?

  1. How To Solve AttributeError: module 'tensorflow' has no attribute 'reset_default_graph' Error ?

    To Solve AttributeError: module 'tensorflow' has no attribute 'reset_default_graph' Error It's possible that you have named a file in your project tensorflow.py and the import statement is importing from this file.

  2. AttributeError: module 'tensorflow' has no attribute 'reset_default_graph'

    To Solve AttributeError: module 'tensorflow' has no attribute 'reset_default_graph' Error It's possible that you have named a file in your project tensorflow.py and the import statement is importing from this file.

Solution 1

You normally import tensorflow by writing,

import tensorflow as tf

It’s possible that you have named a file in your project tensorflow.py and the import statement is importing from this file.

Alternatively, you can try this,

from tensorflow.python.framework import ops
ops.reset_default_graph()

Solution 2

This function is deprecated. Use tf.compat.v1.reset_default_graph() instead.

Update This is not the only function to be out of date. Check out this answer for release notes and a conversion script.

Summery

It’s all About this issue. Hope all solution helped you a lot. Comment below Your thoughts and your queries. Also, Comment below which solution worked for you? Thank You.

Also, Read