So suppose I have a tensor
X = tf.placeholder("float", [None, 5])
nrows x 1
o = tf.ones(shape=(tf.shape(X), 1))
==> TypeError: List of Tensors when single Tensor expected
o = tf.ones(shape=(X.get_shape().value, 1))
==> TypeError: Input 'dims' of 'Fill' Op has type
string that does not match expected type of int32.
o = tf.placeholder(dtype=tf.float32, shape=[None, 1])
The way to solve your problem is to use tf.pack operation:
o = tf.ones(shape=tf.pack([tf.shape(X), 1]))
The reason you had errors is that TensorFlow shape is expected to be a list of integers or a tensor link. tf.pack makes it easy to convert a list of integers and/or TensorFlow scalars into a Tensor object.