0
votes

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?

1
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

1 Answers

-1
votes

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