import tensorflow as tf
a = tf.Variable([
[[1, 1, 1], [1, 1, 1]],
[[2, 2, 2], [2, 2, 2]]
])
b = tf.Variable([
[[3, 3, 3], [3, 3, 3]],
[[4, 4, 4], [4, 4, 4]]
])
c = tf.concat([a, b], 2)
print(c.shape)
init_op = tf.global_variables_initializer()
with tf.Session() as sess:
sess.run(init_op)
print(sess.run(c))
输出结果:
(2, 2, 6)
[[[1 1 1 3 3 3]
[1 1 1 3 3 3]]
[[2 2 2 4 4 4]
[2 2 2 4 4 4]]]