tf.shape() get wrong shape in tensorflow

I define a tensor like this:

x = tf.get_variable("x", [100])

But when I try to print shape of tensor :

print( tf.shape(x) )

I get Tensor("Shape:0", shape=(1,), dtype=int32) , why the result of output should not be shape=(100)

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/

From: stackoverflow.com/q/37085430