text_plain_output_1.png
import tensorflow as tf

configuration = tf.compat.v1.ConfigProto()
configuration.gpu_options.allow_growth = True
session = tf.compat.v1.Session(config=configuration)

img_rows, img_cols, channels = (28, 28, 1)
num_classes = 10
X_train = X_train / 255
X_test = X_test / 255

X_train = X_train.reshape((-1, img_rows, img_cols, channels))
X_test = X_test.reshape((-1, img_rows, img_cols, channels))

y_train = tf.keras.utils.to_categorical(y_train, num_classes)
y_test = tf.keras.utils.to_categorical(y_test, num_classes)

print('X_train set shape of {}'.format(X_train.shape))
print('X_val set shape of {}'.format(X_val.shape))
print('y_train set shape of {}'.format(y_train.shape))
print('y_val set shape of {}'.format(y_val.shape))