I would like to record the usage of tensor shape in Tensorflow.
Suppose a tensor variable A, as before, I would to use the usage A.get_shape() to detect its shape, while this usage has a crucial disadvantage. For example:
A = tf.placeholder(dtype=tf.float32, shape=[None, 28, 281])
At present, we want get the first element values of the shape of A. If we use A.get_shape()[0].value, it will result in None. While if we use tf.shape(A)[0], we will get the real value for the corresponding value.
BTW, A.get_shape()[0] could be performed without the Session initialization, but tf.shape(A)[0] needs to be performed after the Session has been initialized.