写在前面
主要注意参数中的维度选择
import tensorflow as tf import numpy as np
t1 = [[1,2,3], [4,5,6]] t2 = [[7,8,9], [3,4,5]] t3 = tf.concat([t1, t2], 0) t4 = tf.concat([t1, t2], 1)
sess = tf.InteractiveSession() sess.run(tf.global_variables_initializer()) print sess.run(t3) print sess.run(t4)
[[1 2 3] [4 5 6] [7 8 9] [3 4 5]] [[1 2 3 7 8 9] [4 5 6 3 4 5]]