tf.shape(input, name=None) returns a 1-D integer tensor representing the shape of input.
You’re looking for: x.get_shape() that returns the TensorShape of the x variable.
Update: I wrote an article to clarify the dynamic/static shapes in Tensorflow because of this answer: https://pgaleone.eu/tensorflow/2018/07/28/understanding-tensorflow-tensors-shape-static-dynamic/