我是一个初学者,并尝试使用谷歌colab练习张量流。当我尝试在张量流中导入可用的内置数据集(mnist(时,出现以下错误。
许多用户在juypter笔记本中遇到了同样的问题。我正在使用谷歌Colab来利用免费资源
代码片段:
import tensorflow as tf
from tensorflow.examples.tutorials.mnist import input_data
mnist = input_data.read_data_sets("MNIST_data", one_hot=True)
错误:
ModuleNotFoundError Traceback (most recent
call last) <ipython-input-4-4e25ee396bc7> in <module>() ----> 1
from tensorflow.examples.tutorials.mnist import input_data
2 mnist = input_data.read_data_sets("MNIST_data", one_hot=True)
ModuleNotFoundError: No module named
'tensorflow.examples.tutorials'
有人请指导我解决此错误。
谢谢
在顶部写!pip install mnist
.使用import mnist
.
然后只需存储图像和标签:
train_images = mnist.train_images()
train_labels = mnist.train_labels()
test_images = mnist.test_images()
test_labels = mnist.test_labels()
就是这样!!!
<html>
<body>
<div align="center"><p>I can't do that either</p></div>
<style>
@import url("https://fonts.googleapis.com/css?family=Raleway:400,400i,700");
div {
width : 400px;
height : 60px;
background-color : rgb(100,100,255);
border : 1px solid rgb(100,100,255);
box-shadow : 0 0 20px black;
border-radius : 24px;
font-family : Raleway, sans-serif;
transition : 1s;
text-align : center;
}
div:hover{
width : 420px;
height : 80px;
}
p{
margin-right : 20px;
color : white;
}
</style>
</body>
</html>