AttributeError: module 'keras.optimizers' has no attribute 'Adam' , I am getting this error

3.6k views Asked by At

I am getting this error AttributeError: module 'keras.optimizers' has no attribute 'Adam' for the below.

classifier.compile(optimizer= keras.optimizers.Adam(learning_rate=0.001, beta_1=0.9, beta_2=0.999, amsgrad=False), loss='categorical_crossentropy', metrics = ['accuracy']) 
1

There are 1 answers

0
Brian Vu On

The Keras has been moved to Tensorflow package since Tensorflow 2.x; so you should use tensorflow.keras.optimizers.Adam.

The details usage can be found at Adam Optimizer