tf.concat( )的函数用法

版权声明:凡由本人原创,如有转载请注明出处https://me.csdn.net/qq_41424519,谢谢合作 https://blog.csdn.net/qq_41424519/article/details/82114255
import tensorflow as tf
import numpy as np
t1 = [[1, 2, 3], [4, 5, 6]]  
t2 = [[7, 8, 9], [10, 11, 12]]  
t3=tf.concat( [t1, t2],-1)
t4=tf.concat( [t1, t2],1)
t5=tf.concat( [t1, t2],0)
with tf.Session() as sess:
    
    print(sess.run(t3))
    print(sess.run(t4))
    print(sess.run(t5))

输出:

[[ 1  2  3  7  8  9]
 [ 4  5  6 10 11 12]]
[[ 1  2  3  7  8  9]
 [ 4  5  6 10 11 12]]
[[ 1  2  3]
 [ 4  5  6]
 [ 7  8  9]
 [10 11 12]]

猜你喜欢

转载自blog.csdn.net/qq_41424519/article/details/82114255
今日推荐