module 'keras.layers.normalization' has no attribute 'BatchNormalizationBase'

4.2k Views Asked by At

when i run this code

 import os
 from autokeras import 
 StructuredDataClassifier
 import stellargraph as sg
 from stellargraph.mapper import 
 FullBatchNodeGenerator
 from tensorflow.keras import layers, 
 optimizers, losses, metrics, Model
 from sklearn import preprocessing, 
 model_selection
 from IPython.display import display, HTML
 import matplotlib.pyplot as plt
 %matplotlib inline

i have this error

 AttributeError: module 'keras.layers.normalization' has no attribute 'BatchNormalizationBase'

Knowing that this code has been run many times without any problems

2

There are 2 best solutions below

0
AbbasEbadian On

In my case which had a structure like this:

enter image description here

I added these two lines to the__init__.py file:

from keras.layers.normalization.layer_normalization import *
from keras.layers.normalization.batch_normalization import *

And problem fixed.

0
muhammad On

restart runtime then reinstall keras library