lmoroney / dlaicourse

Notebooks for learning deep learning
5.66k stars 5.36k forks source link

Update for Adam optimizer compatibility on TF 2.0 #47

Open laurauzcategui opened 4 years ago

laurauzcategui commented 4 years ago

Fix for Update for Adam optimizer compatibility on TF 2.0

https://github.com/lmoroney/dlaicourse/issues/46

Updated:

model.compile(optimizer = tf.train.Adam(),
              loss = 'sparse_categorical_crossentropy',
              metrics=['accuracy'])

to be:

model.compile(optimizer = 'adam',
              loss = 'sparse_categorical_crossentropy',
              metrics=['accuracy'])

to fix compatibility issues with TF 2.0

laurauzcategui commented 4 years ago

Yet, another more elegant solution could be the convert to: tf.keras.optimizers.Adam()

I'm happy to update it, if you prefer @lmoroney 😄