tf.concat([tensor1, tensor2, tensor3,...], axis)
表示在第0维度上进行拼接;表示在第0维度上进行拼接。
import tensorflow as tf
t1=tf.constant([1,2,3])
t2=tf.constant([4,5,6])
t3=tf.concat([t1, t2], 0)
print(t3)
with tf.Session() as sess:
#sess.run(tf.global_variables_initializer)
print(sess.run(t3))
运行结果:
Tensor("concat:0", shape=(6,), dtype=int32)
[1 2 3 4 5 6]