转载自: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了

最新文章

  1. 深入浅出学Spring Data JPA
  2. php生成网页桌面快捷方式
  3. RDIFramework.NETV2.9版本 Web新增至14套皮肤风格+三套界面组合(共42套皮肤组合)
  4. (翻译)为你的MVC应用程序创建自定义视图引擎
  5. Struts2文件上传(基于表单的文件上传)
  6. BI与大数据
  7. git常用命令[持续更新]
  8. sort-based shuffle的核心:org.apache.spark.util.collection.ExternalSorter
  9. bzoj2539
  10. cf Ping-Pong (Easy Version)
  11. iOS 设置文本中指定某段文本的颜色 大小
  12. centos7上修改主机名
  13. kali linux 2.0 web 渗透测试 电子书
  14. Oracle 11g 测试ogg中断之后,重新同步操作
  15. Inline Route Constraints in ASP.NET Core MVC
  16. 简单封装kafka相关的api
  17. 基于redis的分布式ID生成器
  18. 【转】escape,encodeURI,encodeURIComponent有什么区别?
  19. liblinear使用总结
  20. Codeforces.838E.Convex Countour(区间DP)

热门文章

  1. 模板内置函数(HTML)
  2. poj2125 最小点权覆盖集
  3. 聊聊jdk http的HeaderFilter
  4. thinkphp常用的一些函数
  5. LeetCode172 Factorial Trailing Zeroes. LeetCode258 Add Digits. LeetCode268 Missing Number
  6. [React Native]Promise机制
  7. 【JZOJ4868】【NOIP2016提高A组集训第9场11.7】Simple
  8. navicat for mysql 在Mac上安装后没有连接列表,就是左边的那一列连接项目怎么办?
  9. idea建立maven聚合项目 标签: mavenidea 2017-01-08 15:33 2477人阅读 评论(30)
  10. C++运行时类型识别