MNIST dataset Training Error.

63 views
Skip to first unread message

lakshmi...@gmail.com

unread,
Apr 5, 2020, 10:48:29 AM4/5/20
to Keras-users
Hi, I am trying to implement the MNIST usiing CNN in Keras, https://github.com/keras-team/keras/blob/master/examples/mnist_cnn.py , 

when I ran on google Colab,


model.fit(x_train, y_train,
          batch_size=batch_size,
          epochs=epochs,
          verbose=1,
          validation_data=(x_test, y_test))


 its showing error:

AttributeError: module 'tensorflow' has no attribute 'log'

Could you help me with this.

Thanking you.

Paul Pauls

unread,
Apr 5, 2020, 3:25:20 PM4/5/20
to Keras-users
The example code to which you provide a hyperlink is from Feb 2018 and is intended for Tensorflow 1.x
However, Tensorflow released version 2.0 in fall 2019, which is at times incompatible with code written for Tensorflow 1.x

Google colab automatically loads the latest package versions and therefore loads Tensorflow 2.2 if you don't specify anything else in you colab notebook.
The code executed to Google colab is therefore incompatible with loaded libraries, therefore causing your error.

Add the following command at top of you Google colab notebook in order for it to load a specific version of Tensorflow:
!pip install tensorflow==1.15.2


Your colab notebook should now work, as I demonstrated here:
Reply all
Reply to author
Forward
0 new messages