tf.concat(axis, [list1, list2])用于合并两个迭代器(比如列表)。axis表示合并的方向。0表示竖直合并,1表示水平
比如:
import tensorflow as tf;
from tensorflow.examples.tutorials.mnist import input_data
import numpy as np;
import os
t1 = [[1, 2, 3], [4, 5, 6]]
t2 = [[7, 8, 9], [10, 11, 12]]
print tf.Session().run(tf.concat(0, [t1, t2]))
print tf.Session().run(tf.concat(1, [t1, t2]))
输出:
[[ 1 2 3]
[ 4 5 6]
[ 7 8 9]
[10 11 12]]
[[ 1 2 3 7 8 9]
[ 4 5 6 10 11 12]]