Issue
I am currently following this intro tutorial on the Keras website: https://www.tensorflow.org/tutorials/keras/basic_classification
Several steps in I run into this error after calling fashion_mnist.load_data()
:
AttributeError: module 'tensorflow.python.keras.datasets.fashion_mnist' has no attribute 'load_data'
This is the full output:
Python 3.6.6 (v3.6.6:4cf1f54eb7, Jun 27 2018, 03:37:03) [MSC v.1900 64 bit (AMD64)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> import tensorflow as tf
>>> from tensorflow import keras
>>> fashion_mnist = keras.datasets.fashion_mnist
>>> (train_images, train_labels), (test_images, test_labels) = fashion_mnist.load_data()
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
AttributeError: module 'tensorflow.python.keras.datasets.fashion_mnist' has no attribute 'load_data'
I'm using tensorflow 1.5.0
, Keras 2.2.2
, and Python 3.6.6
.
Is tensorflow's tutorial outdated, or am I missing something? If I use the mnist
set instead of fashion_mnist
, it works with no problem. From this link https://www.tensorflow.org/api_docs/python/tf/keras/datasets/fashion_mnist it would seem that fashion_mnist
does indeed have a function called load_data
.
Solution
The problem lies indeed in your Tensorflow version. The tutorial you link to uses version 1.9.0:
print(tf.__version__)
# 1.9.0
which does include a function load_data
for fashion_mnist
(docs). But this function is missing from your version, as you can see from the v1.5 docs.
Answered By - desertnaut
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.