TensorFLow:ConnectionResetError:[WinError 10054]现有连接被远程主机强行关闭

时间:2019-09-27 15:24:21

标签: python tensorflow keras

我是研究张量流的初学者。 我在下面列出代码,但是在运行它时遇到问题,写为:

"ConnectionResetError: [WinError 10054] An existing connection was forcibly closed by the remote host"

有人可以帮助我如何处理清楚的解释吗?因为我是初学者,所以我对tensorflow不太了解。非常感谢您。下面是我的代码:

import tensorflow as tf
print(tf.__version__)
mnist = tf.keras.datasets.fashion_mnist
(training_images, training_labels), (test_images, test_labels)= mnist.load_data()
import matplotlib.pyplot as plt
plt.imshow(training_images[0])
print(training_labels[0])
print(training_images[0])
training_images = training_images / 255.0
test_images = test_images / 255.0
model = tf.keras.models.Sequential([tf.keras.layers.Flatten(),
                                    tf.keras.layers.Dense(128, activation=tf.nn.relu),
                                    tf.keras.layers.Dense(10, activation=tf.nn.softmax)])
model.compile(optimizer=tf.train.AdamOPtimizer(),
              loss= 'sparse_categorical_crossentropy',
              metrics= ['accuracy'])
model.fit(training_images, training_labels, epochs=5)
model.evaluate(test_images, test_labels)

0 个答案:

没有答案