Search code examples
keras-2

Loading Keras dataset mnist


After installing keras gpu, I try the simple example:

import keras
print(keras.__version__)

Prints the following output:

2.2.4 

Using TensorFlow backend.

However, when I try to load a dataset:

form keras.datasets import mnist

It gives an error:

File "<ipython-input-12-3386782fae62>", line 1
    form keras.datasets import mnist
             ^
SyntaxError: invalid syntax

Solution

  • form is not a python keyword. Try from.

    This is the import line from the Keras datasets page:

    from keras.datasets import mnist