python加载MNIST

安装tensorflow

pip install tensorflow

加载MNIST

import tensorflow as tf  

mnist = tf.keras.datasets.mnist  
(x_train, y_train), (x_test, y_test) = mnist.load_data()

print(x_train.shape)
print(y_train.shape)
print(x_test.shape)
print(y_test.shape)
展开/折叠结果
>>> print(x_train.shape)
(60000, 28, 28)
>>> print(y_train.shape)
(60000,)
>>> print(x_test.shape)
(10000, 28, 28)
>>> print(y_test.shape)
(10000,)

评论

发表评论

了解 数据控|突破是我们的每一步 的更多信息

立即订阅以继续阅读并访问完整档案。

继续阅读