Search code examples
pythontensorflowpack

How to pack two values of shape (?, 2) and (?, 3) in tensorflow?


I'm trying to use tf.pack on two values that have shape (?, 2) and (?, 3) by axis=0, but I get the error that they're incompatible. Is there a way for me to stack the values by columns so I have a value of shape (?, 5)?


Solution

  • You can use tf.concat() for this.

    a = tf.placeholder('float', (None, 2))
    b = tf.placeholder('float', (None, 3))
    c = tf.concat(1, [a,b])