I was following a keras tutorial and I had run this piece of code
import keras
mnist = keras.datasets.mnist
(x_train, y_train), (x_test, y_test) = mnist.load_data()
and I get this error message
AttributeError: module 'keras' has no attribute 'datasets'
I've tried to look up other people with the same question, but can't seem to find the exact answer. How can I resolve this?
Edited code :
import tensorflow.keras as tk
mnist = tk.datasets.mnist
(x_train, y_train), (x_test, y_test) = mnist.load_data()
Reference:
https://keras.io/api/datasets/
https://www.tensorflow.org/api_docs/python/tf/keras/datasets/mnist/load_data
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With