tensorflowチャネルの組合せ

711 ワード

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 1 3 3]]
[[2 2 2 4 4 4] [2 2 2 4 4 4]]]