TensorFlow initializing Tensor of ones
The way to solve your problem is to use tf.pack operation:
o = tf.ones(shape=tf.pack([tf.shape(X)[0], 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.