日韩性视频-久久久蜜桃-www中文字幕-在线中文字幕av-亚洲欧美一区二区三区四区-撸久久-香蕉视频一区-久久无码精品丰满人妻-国产高潮av-激情福利社-日韩av网址大全-国产精品久久999-日本五十路在线-性欧美在线-久久99精品波多结衣一区-男女午夜免费视频-黑人极品ⅴideos精品欧美棵-人人妻人人澡人人爽精品欧美一区-日韩一区在线看-欧美a级在线免费观看

歡迎訪問 生活随笔!

生活随笔

當(dāng)前位置: 首頁 > 编程资源 > 编程问答 >内容正文

编程问答

TensorFlow 合并与分割

發(fā)布時(shí)間:2025/3/20 编程问答 20 豆豆
生活随笔 收集整理的這篇文章主要介紹了 TensorFlow 合并与分割 小編覺得挺不錯(cuò)的,現(xiàn)在分享給大家,幫大家做個(gè)參考.

學(xué)習(xí)課程

1.concat

a=tf.random_normal([4,35,8]) b=tf.random_normal([2,35,8]) c=tf.concak([a,b],axis=0) c.shape #TensorShape([6,35,8])a=tf.random_normal([4,30,8]) b=tf.random_normal([4,35,8]) c=tf.concak([a,b],axis=1) c.shape #TensorShape([4,65,8])


2.stack: create new dim

a=tf.random_normal([4,35,8]) b=tf.random_normal([4,35,8]) tf.concat([a,b],axis=-1).shape #TensorShape([4,35,16])tf.stack([a,b],axis=0).shape #TensorShape([2,4,35,8]) tf.stack([a,b],axis=3).shape #TensorShape([4,35,8,2])

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)容,希望文章能夠幫你解決所遇到的問題。

如果覺得生活随笔網(wǎng)站內(nèi)容還不錯(cuò),歡迎將生活随笔推薦給好友。