0

I'm following a basic tensorflow tutorial (to recognize the 28x28 pixel handwritten digits 0-9), but when I run these two lines:

import tensorflow as tf

mnist = tf.keras.datasets.mnist

I get the error message

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

I've looked at posts where people have similar questions, and it seems the answers are usually to update your tensorflow and keras version, but I think I did that already, and this error message is still appearing. How can I resolve this issue?

allangelman
  • 1
  • 1
  • 2
  • You probably want to see your file name. I was looking at literally EVERYTHING to find what was causing it, and it turned out I named my file tensorboard.py. Don't name your files tensorflow.py or tensorboard.py or any other module names in general – CrazyVideoGamer Aug 15 '20 at 02:00

1 Answers1

-1

I think you have typo there. Should change this line:

mnist = tf.kera.datasets.mnist

to:

mnist = tf.keras.datasets.mnist

Notice that I change kera to keras

Yosua Michael
  • 165
  • 1
  • 2
  • 7
  • oh that was my bad! I just fixed that and now it is giving me the same error (but this time with 'keras': "AttributeError: module 'tensorflow' has no attribute 'keras' " – allangelman Dec 28 '18 at 16:17
  • What is your tensorflow version? You can check using this method: https://stackoverflow.com/questions/38549253/how-to-find-which-version-of-tensorflow-is-installed-in-my-system – Yosua Michael Jan 02 '19 at 14:29