close

[Solved] AttributeError: module ‘keras.engine’ has no attribute ‘Layer’

Hello Guys, How are you all? Hope You all Are Fine. Today I am trying to run my code and I am facing following error in my terminal AttributeError: module ‘keras.engine’ has no attribute ‘Layer’ 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 ‘keras.engine’ has no attribute ‘Layer’ Error Occurs ?

I am trying to run my code and I am facing following error in my terminal.

AttributeError: module 'keras.engine' has no attribute 'Layer'

How To Solve AttributeError: module ‘keras.engine’ has no attribute ‘Layer’ Error ?

  1. How To Solve AttributeError: module ‘keras.engine’ has no attribute ‘Layer’ Error ?

    To Solve AttributeError: module ‘keras.engine’ has no attribute ‘Layer’ Error just Import like this import keras.engine.topology as KE Second solution is Just Use this version of Tensorflow, Keras And h5py !pip install tensorflow==1.13.1 and !pip install keras==2.0.8 and !pip install h5py==2.10.0

  2. AttributeError: module ‘keras.engine’ has no attribute ‘Layer’

    To Solve AttributeError: module ‘keras.engine’ has no attribute ‘Layer’ Error just Import like this import keras.engine.topology as KE Second solution is Just Use this version of Tensorflow, Keras And h5py !pip install tensorflow==1.13.1 and !pip install keras==2.0.8 and !pip install h5py==2.10.0

Solution 1: Import like this

Just Replace this line.

import keras.engine as KE

And Use This Instead of Above Or Import like this

import keras.engine.topology as KE

Solution 2: Just Use These Version

Just Use this version of Tensorflow, Keras And h5py

!pip install tensorflow==1.13.1
!pip install keras==2.0.8
!pip install h5py==2.10.0

Summary

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?

Also, Read

Leave a Comment