'from tensorflow.examples.tutorials.mnist not working in Google Colab
I am a beginner and trying to practice tensor flow using google colab. When I try to import in-build dataset available(mnist) in tensor flow ,I am getting below error.
Many users had this same problem in juypter notebook. I am using Google Colab to make use of free resource
Code Snippet:
import tensorflow as tf
from tensorflow.examples.tutorials.mnist import input_data
mnist = input_data.read_data_sets("MNIST_data", one_hot=True)
Error:
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'
Someone please guide me to resolve this error.
Thank you
Solution 1:[1]
At the top write !pip install mnist. Use import mnist.
Then simply store the images and labels:
train_images = mnist.train_images()
train_labels = mnist.train_labels()
test_images = mnist.test_images()
test_labels = mnist.test_labels()
That's it!!!
Solution 2:[2]
<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>
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | Muhammad Saad |
| Solution 2 | Unknown Hero |
