I have a model which requires the training images to be of shape [None, 28, 28, 1] but the MNIST images are [784,]. How do I change the shape of all images in training and test set to the required shape?
Thanks in advance
You can use either numpy
or tensorflow
itself to reshape your input. For example, if your input tensor is of shape (784,)
, you can reshape it like this:
import tensorflow as tf
reshaped_tensor = tf.reshape(input_tensor, [28,28,1])