如何使用TensorFlow 2.0解决错误?

时间:2019-12-23 17:46:45

标签: tensorflow

我是Tensorflow的新手,正在使用Keras来帮助我。我有以下代码:

import tensorflow as tf
from tensorflow import keras
import numpy as np
import matplotlib.pyplot as plt

dataset = keras.datasets.fashion_mnist

(train_images, train_labels), (test_images, test_labels) = dataset.load_data()

但是,当我运行此程序时,出现此错误:

Traceback (most recent call last):
  File "/Users/[REDACTED]", line 8, in <module>
    (train_images, train_labels), (test_images, test_labels) = dataset.load_data()
  File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/tensorflow_core/python/keras/datasets/fashion_mnist.py", line 59, in load_data
    imgpath.read(), np.uint8, offset=16).reshape(len(y_train), 28, 28)
  File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/gzip.py", line 276, in read
    return self._buffer.read(size)
  File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/gzip.py", line 482, in read
    raise EOFError("Compressed file ended before the "
EOFError: Compressed file ended before the end-of-stream marker was reached

我访问了所有引用的文件,但找不到问题

使用iMac,Python 3.6

帮助!

0 个答案:

没有答案