Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
from tensorflow.keras.utils import to_categorical
# Normalize the images
train_images = train_images / 255.0
test_images = test_images / 255.0
# Reshape them for our CNN model
train_images = train_images.reshape(60000,28,28,1)
test_images = test_images.reshape(10000,28,28,1)
# Encode labels to one-hot
train_labels = to_categorical(train_labels)
test_labels = to_categorical(test_labels)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment