How to concatenate two tensors horizontally in TensorFlow?

后端 未结 3 814
终归单人心
终归单人心 2021-02-14 22:20

I have 2 tensors of shape (100, 4) and (100, 2). I would like to perform a concatenation operation, in TensorFlow, similar to np.hstack,

3条回答
  •  抹茶落季
    2021-02-14 22:52

    I tried the above code, I got some error. The following code runs fine with tf 1.15 version:

    x = tf.constant( [[1, 2,4],[7,8,12]])
    

    y = tf.constant([[88],[99]])

    res=tf.concat([x, y],1)
    

提交回复
热议问题