TensorFlow 合并与分割
生活随笔
收集整理的這篇文章主要介紹了
TensorFlow 合并与分割
小編覺得挺不錯(cuò)的,現(xiàn)在分享給大家,幫大家做個(gè)參考.
學(xué)習(xí)課程
1.concat
2.stack: create new dim
3.Unstack
a=tf.random_normal([4,35,8]) b=tf.random_normal([4,35,8]) c=tf.stack([a,b]) c.shape #TensorShape([2,4,35,8]) aa,bb=tf.unstack(c,axis=0) aa.shape,bb.shape #TensorShape([4,35,8]),TensorShape([4,35,8])res=tf.unstack(c,axis=3) res[0].shape,res[7].shape #TensorShape([2,4,35]),TensorShape([2,4,35])4.Split
a=tf.random_normal([4,35,8]) b=tf.random_normal([4,35,8]) c=tf.stack([a,b]) c.shape #TensorShape([2,4,35,8]) res=tf.split(c,axis=3,num_or_size_splits=2) len(res) ##2 res.shape[0] #TensorShape([2,4,35,4])res=tf.split(c,axis=3,num_or_size_split=[2,2,4]) res.shape[0],res.shape[1] ,res.shape[2] #TensorShape([2,4,35,2]),TensorShape([2,4,35,2]),TensorShape([2,4,35,4])總結(jié)
以上是生活随笔為你收集整理的TensorFlow 合并与分割的全部?jī)?nèi)容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: TensorFlow维度变换函数语句
- 下一篇: TensorFlow数据统计