tf.concat()
2024-10-08 02:10:49
转载自:https://blog.csdn.net/appleml/article/details/71023039
https://www.cnblogs.com/mdumpling/p/8053474.html
tf.concat(concat_dim, values, name='concat')
t1 = [[1, 2, 3], [4, 5, 6]]
t2 = [[7, 8, 9], [10, 11, 12]]
tf.concat(0, [t1, t2]) == > [[1, 2, 3], [4, 5, 6], [7, 8, 9], [10, 11, 12]]
tf.concat(1, [t1, t2]) ==> [[1, 2, 3, 7, 8, 9], [4, 5, 6, 10, 11, 12]]
tf.shape(tf.concat(0, [t3, t4])) ==> [4, 3]
tf.shape(tf.concat(1, [t3, t4])) ==> [2, 6]
一维拼接:
t1=tf.constant([1,2,3])
t2=tf.constant([4,5,6])
#concated = tf.concat(1, [t1,t2])这样会报错
t1=tf.expand_dims(tf.constant([1,2,3]),1)
t2=tf.expand_dims(tf.constant([4,5,6]),1)
concated = tf.concat(1, [t1,t2])#这样就是正确的
如果想沿着tensor新轴连接打包,则tf.concat(axis, [tf.expand_dims(t, axis) for t in tensors]),等价于tf.pack(tensors, axis=axis),tf.pack改名为tf.stack了
最新文章
- 深入浅出学Spring Data JPA
- php生成网页桌面快捷方式
- RDIFramework.NETV2.9版本 Web新增至14套皮肤风格+三套界面组合(共42套皮肤组合)
- (翻译)为你的MVC应用程序创建自定义视图引擎
- Struts2文件上传(基于表单的文件上传)
- BI与大数据
- git常用命令[持续更新]
- sort-based shuffle的核心:org.apache.spark.util.collection.ExternalSorter
- bzoj2539
- cf Ping-Pong (Easy Version)
- iOS 设置文本中指定某段文本的颜色 大小
- centos7上修改主机名
- kali linux 2.0 web 渗透测试 电子书
- Oracle 11g 测试ogg中断之后,重新同步操作
- Inline Route Constraints in ASP.NET Core MVC
- 简单封装kafka相关的api
- 基于redis的分布式ID生成器
- 【转】escape,encodeURI,encodeURIComponent有什么区别?
- liblinear使用总结
- Codeforces.838E.Convex Countour(区间DP)
热门文章
- 模板内置函数(HTML)
- poj2125 最小点权覆盖集
- 聊聊jdk http的HeaderFilter
- thinkphp常用的一些函数
- LeetCode172 Factorial Trailing Zeroes. LeetCode258 Add Digits. LeetCode268 Missing Number
- [React Native]Promise机制
- 【JZOJ4868】【NOIP2016提高A组集训第9场11.7】Simple
- navicat for mysql 在Mac上安装后没有连接列表,就是左边的那一列连接项目怎么办?
- idea建立maven聚合项目 标签: mavenidea 2017-01-08 15:33 2477人阅读 评论(30)
- C++运行时类型识别