lmoroney / dlaicourse

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

TF 2.0 compatibility, course 1 - part 4 - lesson 2 #23

Open erkandiken opened 5 years ago

erkandiken commented 5 years ago

I have reworked the notebook with Tf 2.0.0-alpha0

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

throws

AttributeError: module 'tensorflow._api.v2.train' has no attribute 'AdamOptimizer'

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

seems to be (one of the) new way of passing optimizers.