In [2]:
import tensorflow as tf
from tensorflow.examples.tutorials.mnist import input_data
mnist=input_data.read_data_sets('MNIST_data',one_hot=True)


Extracting MNIST_data/train-images-idx3-ubyte.gz
Extracting MNIST_data/train-labels-idx1-ubyte.gz
Extracting MNIST_data/t10k-images-idx3-ubyte.gz
Extracting MNIST_data/t10k-labels-idx1-ubyte.gz

In [23]:
batch=mnist.train.next_batch(3)
xs=batch[0]
ys=batch[1]

In [24]:
xs


Out[24]:
array([[ 0.,  0.,  0., ...,  0.,  0.,  0.],
       [ 0.,  0.,  0., ...,  0.,  0.,  0.],
       [ 0.,  0.,  0., ...,  0.,  0.,  0.]], dtype=float32)

In [25]:
ys


Out[25]:
array([[ 0.,  0.,  0.,  0.,  1.,  0.,  0.,  0.,  0.,  0.],
       [ 0.,  0.,  0.,  0.,  0.,  0.,  0.,  1.,  0.,  0.],
       [ 0.,  1.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.]])

In [26]:
import numpy as np
x=np.reshape(xs[0],newshape=(28,28))

In [27]:
%matplotlib inline
from matplotlib import pyplot as plt
plt.imshow(x,'gray')


Out[27]:
<matplotlib.image.AxesImage at 0x13666b9e8>

In [ ]: