I'm following the TensorFlow tutorial

Initially, x is defined as

x = tf.placeholder(tf.float32, shape=[None, 784])

Later on, it reshapes x, I'm trying to understand why.

To apply the layer, we first reshape x to a 4d tensor, with the second and third dimensions corresponding to image width and height, and the final dimension corresponding to the number of color channels.

x_image = tf.reshape(x, [-1,28,28,1])

What does -1 mean in the reshaping vector and why is x being reshaped?