close

How to fix “AttributeError: module ‘tensorflow’ has no attribute ‘get_default_graph'”?

Hello Guys, How are you all? Hope You all Are Fine. Today We Are Going To learn about How to fix “AttributeError: module ‘tensorflow’ has no attribute ‘get_default_graph'” in Python. So Here I am Explain to you all the possible Methods here.

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

How to fix “AttributeError: module ‘tensorflow’ has no attribute ‘get_default_graph'”?

  1. How to fix “AttributeError: module 'tensorflow' has no attribute 'get_default_graph'”?

    Turns out I was using the wrong version (2.0.0a0), so i reset to the latest stable version (1.13.1) and it works.

  2. fix “AttributeError: module 'tensorflow' has no attribute 'get_default_graph'”?

    Turns out I was using the wrong version (2.0.0a0), so i reset to the latest stable version (1.13.1) and it works.

Method 1

Please try:

from tensorflow.keras.models import Sequential

instead of

from keras.models import Sequential

Method 2

Turns out I was using the wrong version (2.0.0a0), so i reset to the latest stable version (1.13.1) and it works.

Summery

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

Also, Read