from future import absolute_import, division, print_function, unicode_literals, unicode_literals
tensorflow와 tf.keras를 임포트합니다
import tensorflow as tf
from tensorflow import keras
헬퍼(helper) 라이브러리를 임포트합니다
import numpy as np
import matplotlib.pyplot as plt
print(tf.version)
fashion_mnist = keras.datasets.fashion_mnist
(train_images, train_labels), (test_images, test_labels) = fashion_mnist.load_data()
print(fashion_mnist)
class_names = [‘T-shirt/top’, ‘Trouser’, ‘Pullover’, ‘Dress’, ‘Coat’, ‘Sandal’, ‘Shirt’, ‘Sneaker’, ‘Bag’, ‘Ankle boot’]
print(class_names)
print(train_images.shape)
print(len(train_labels))
print(train_labels)
print(test_images.shape)
print(len(test_labels))
print(test_labels)
plt.figure()
plt.imshow(train_images[0])
plt.colorbar()
plt.grid(False)
plt.show()
train_images = train_labels / 255.0
test_images = test_images / 255.0
plt.figure(figsize=(10, 10))
for i in range(25):
plt.subplot(5, 5, i+1)
plt.xticks([])
plt.yticks([])
plt.grid(False)
plt.imshow(train_images[i], cmap=plt.cm.binary)   #here <<<<<<<<<<<<<<<
plt.xlabel(class_names[train_labels[i]])
plt.show()
model = keras.Sequential([
keras.layers.Flatten(input_shape=(28, 28)),
keras.layers.Dense(128, activation=‘relu’),
keras.layers.Dense(10, activation=‘softmax’)
])
Traceback (most recent call last):
File “C:/Users/chabu/PycharmProjects/untitled1/ke.py”, line 50, in 
plt.imshow(train_images[i], cmap=plt.cm.binary)
File “C:\Users\chabu\Anaconda3\lib\site-packages\matplotlib\pyplot.py”, line 2683, in imshow
None else {}), **kwargs)
File “C:\Users\chabu\Anaconda3\lib\site-packages\matplotlib_init_.py”, line 1601, in inner
return func(ax, *map(sanitize_sequence, args), **kwargs)
File “C:\Users\chabu\Anaconda3\lib\site-packages\matplotlib\cbook\deprecation.py”, line 369, in wrapper
return func(*args, **kwargs)
File “C:\Users\chabu\Anaconda3\lib\site-packages\matplotlib\cbook\deprecation.py”, line 369, in wrapper
return func(*args, **kwargs)
File “C:\Users\chabu\Anaconda3\lib\site-packages\matplotlib\axes_axes.py”, line 5671, in imshow
im.set_data(X)
File “C:\Users\chabu\Anaconda3\lib\site-packages\matplotlib\image.py”, line 690, in set_data
.format(self._A.shape))
TypeError: Invalid shape () for image data