tf.concat是连接两个矩阵的操作,tf.concat(values,dim,name='concat')

按照dim给定的维度进行拼接,即,相应的维度增加,例子如下:

 矩阵维度简单情形(shape为[2,3])t1 = [[1, 2, 3], [4, 5, 6]]t2 = [[7, 8, 9], [10, 11, 12]]拼接后结果:tf.concat([t1, t2], 0)  # [[1, 2, 3], [4, 5, 6], [7, 8, 9], [10, 11, 12]]tf.concat([t1, t2], 1)  # [[1, 2, 3, 7, 8, 9], [4, 5, 6, 10, 11, 12]]对拼接的结果shapetf.shape(tf.concat([t1, t2], 0))  #新的维度shape [4, 3]tf.shape(tf.concat([t1, t2], 1))  #新的维度shape [2, 6]这里解释了当axis=0和axis=1的情况,怎么理解这个axis呢?其实这和numpy中的np.concatenate()用法是一样的。axis=0     代表在第0个维度拼接axis=1     代表在第1个维度拼接 矩阵都是2*2*2维度的情形t1 = [[[1, 2], [2, 3]], [[4, 4], [5, 3]]]t2 = [[[7, 4], [8, 4]], [[2, 10], [15, 11]]]tf.concat([t1, t2], axis=-1)-1表示最后一个维度,最后一个维度增加输出结果为<tf.Tensor 'concat_2:0' shape=(2, 2, 4) dtype=int32>

tf.concat用法总结相关推荐

  1. 【TensorFlow基础函数】tf.concat的用法

    tf.concat 的用法 TF官方的文档 tf.concat(values,axis,name='concat' ) 连接多个Tensor的操作 values 多个Tensor axis是哪个纬度 ...

  2. tf.concat, tf.stack和tf.unstack的用法

    tf.concat, tf.stack和tf.unstack的用法 tf.concat相当于numpy中的np.concatenate函数,用于将两个张量在某一个维度(axis)合并起来,例如: a ...

  3. 【TensorFlow】tf.concat的用法

    tf.concat是连接两个矩阵的操作 tf.concat(concat_dim, values, name='concat') 除去name参数用以指定该操作的name,与方法有关的一共两个参数: ...

  4. tf.concat()详解

    tensorflow中用来拼接张量的函数tf.concat(),用法: tf.concat([tensor1, tensor2, tensor3,...], axis) 先给出tf源代码中的解释: t ...

  5. TF:tensorflow框架中常用函数介绍—tf.Variable()和tf.get_variable()用法及其区别

    TF:tensorflow框架中常用函数介绍-tf.Variable()和tf.get_variable()用法及其区别 目录 tensorflow框架 tensorflow.Variable()函数 ...

  6. tensorflow随笔 -tf.concat

    tf.concat tf.concat( values, axis, name='concat' ) 按一维连接张量. 沿着维度轴连接张量值的列表.如果values[i].shape=[D0, D1, ...

  7. boost::hana::concat用法的测试程序

    boost::hana::concat用法的测试程序 实现功能 C++实现代码 实现功能 boost::hana::concat用法的测试程序 C++实现代码 #include <boost/h ...

  8. 记录 之 tensorflow中几个常用的函数:tf.unstack,tf.concat() 和 tf.stack() 等

    1.tf.to_int32():tf.to_float()等 函数,主要是强制类型转换函数: 2.tf.shape(tensor):获取tensor的尺寸 3.tf.round(a):四舍五入函数,张 ...

  9. tf.concat, np.concatenate

    tf.concat(concat_dim, values, name='concat'),   连接两个矩阵的操作 除去name参数用以指定该操作的name,与方法有关的一共两个参数: 第一个参数co ...

  10. python的concat用法_python的concat等多种用法详解

    本文为大家分享了python的concat等多种用法,供大家参考,具体内容如下 1.numpy中的concatenate()函数: >>> a = np.array([[1, 2], ...

最新文章

  1. 半可信混合技术:BCH混币工具CashShuffle引入STAT
  2. 记一次灵活的模型训练生成的pth转onnx文件失败
  3. 让人期待的2011年度最佳 jQuery 插件发布啦
  4. java after 函数_Java中关于Date的before函数和after函数的使用
  5. delphi ascii字符数组_344. 反转字符串
  6. 计算机硬件知识竞赛题库,电脑知识竞赛题库.pdf
  7. MySQL 体系结构
  8. mavenFailed to execute goal org.apache.maven.plugins:maven-surefire-plugin解决方法
  9. python基础知识-Python语言基础知识总结
  10. 2020-我的后端开发秋招之路
  11. 用 new 还是用 alloc/init
  12. 中国游戏发展史V-02
  13. 计算机二级公共知识web,全国计算机等级考试二级web大纲
  14. 西数linux驱动程序,下载:西数移动硬盘WD SES Driver驱动更新
  15. java坦克大战图片素材包_坦克大战图片素材
  16. 有效集法(Active Set),内点法(Interior-Point)及序列二次规划(SQP)法
  17. 随机森林python反欺诈_携程金融自动化迭代反欺诈模型体系
  18. iOS修改生成的APP名称
  19. 流控大师 panabit
  20. 手把手教你做一个APP应用(含源码)

热门文章

  1. Install-Package Ninject -Project SportsStore.WebUI
  2. adbe Air/flash swf中不能正常显示系统字体问题的解决方案
  3. 小心中中国移动“短号集群网”的招
  4. 随手练—— 洛谷-P2945 Sand Castle(贪心)
  5. html dom之iframe对象
  6. [Ubuntu] change mouse scrolling between standard and natural
  7. Autorun 文件结构
  8. 数据结构:二维ST表
  9. js 对url进行编码和解码的三种方式
  10. Java并发:Callable、Future和FutureTask