**

一 tf.concat( ) 函数–合并

**

In [2]: a = tf.ones([4,35,8])                                                   In [3]: b = tf.ones([2,35,8])                                                   In [4]: c = tf.concat([a,b],axis=0)                                             In [5]: c.shape
Out[5]: TensorShape([6, 35, 8])In [6]: a = tf.ones([4,32,8])                                                   In [7]: b = tf.ones([4,3,8])                                                    In [8]: c = tf.concat([a,b],axis=1)                                             In [9]: c.shape
Out[9]: TensorShape([4, 35, 8])

**

二 tf.stack( ) 函数–数据的堆叠,创建新的维度

**

In [2]: a = tf.ones([4,35,8])                                                   In [3]: a.shape
Out[3]: TensorShape([4, 35, 8])In [4]: b = tf.ones([4,35,8])                                                   In [5]: b.shape
Out[5]: TensorShape([4, 35, 8])In [6]: tf.concat([a,b],axis=-1).shape
Out[6]: TensorShape([4, 35, 16])In [7]: tf.stack([a,b],axis=0).shape
Out[7]: TensorShape([2, 4, 35, 8])In [8]: tf.stack([a,b],axis=3).shape
Out[8]: TensorShape([4, 35, 8, 2])

**

三 tf.unstack( )函数–解堆叠

**

In [16]: a = tf.ones([4,35,8])                                                                                                                                                                              In [17]: b = tf.ones([4,35,8])                                                                                                                                                                              In [18]: c = tf.stack([a,b],axis=0)                                                                                                                                                                         In [19]: a.shape,b.shape,c.shape
Out[19]: (TensorShape([4, 35, 8]), TensorShape([4, 35, 8]), TensorShape([2, 4, 35, 8]))In [20]: aa,bb = tf.unstack(c,axis=0)                                                                                                                                                                       In [21]: aa.shape,bb.shape
Out[21]: (TensorShape([4, 35, 8]), TensorShape([4, 35, 8]))In [22]: res = tf.unstack(c,axis=1)                                                                                                                                                                         In [23]: len(res)
Out[23]: 4

**

四 tf.split( ) 函数

**

In [16]: a = tf.ones([4,35,8])                                                                                                                                                                              In [17]: b = tf.ones([4,35,8])                                                                                                                                                                              In [18]: c = tf.stack([a,b],axis=0)                                                                                                                                                                         In [19]: a.shape,b.shape,c.shape
Out[19]: (TensorShape([4, 35, 8]), TensorShape([4, 35, 8]), TensorShape([2, 4, 35, 8]))In [20]: aa,bb = tf.unstack(c,axis=0)                                                                                                                                                                       In [21]: aa.shape,bb.shape
Out[21]: (TensorShape([4, 35, 8]), TensorShape([4, 35, 8]))In [22]: res = tf.unstack(c,axis=1)                                                                                                                                                                         In [23]: len(res)
Out[23]: 4

TensorFlow2.0:张量的合并与分割相关推荐

  1. TensorFlow2.0:张量限幅

    ** 一 tf.clip_by_value( )函数 ** tf.maximum(a,b)返回a和b之间的最大值 tf.minimum(a,b)返回a和b之间的最小值 tf.clip_by_value ...

  2. TensorFlow2.0:张量排序

    ** 一 sort argsort排序 ** tf.sort( )按照升序或者降序对张量进行排序 tf.argsort( )按照升序或者降序对张量进行排序,但返回的是索引 In [4]: a = tf ...

  3. TensorFlow2.0:张量的数学运算

    (1)+ - * / (2)** pow square (3) sqrt (4) // % (5) exp log (6)@ matmul (7) linear layer element-wise: ...

  4. Tensor的合并与分割

    针对tensorflow2.0 1.合并 (1)tensor的拼接(tf.concat) In [5]: a = tf.ones([4,28,28,3])In [6]: b = tf.ones([2, ...

  5. 【TensorFlow2.0】(5) 数学计算、合并、分割

    各位同学好,今天和大家分享一下TensorFlow2.0中的数学运算方法.合并与分割.内容有: (1)基本运算:(2)矩阵相乘:(3)合并 tf.concat().tf.stack():(4)分割 t ...

  6. 【TensorFlow2.0】(7) 张量排序、填充、复制、限幅、坐标选择

    各位同学好,今天和大家分享一下TensorFlow2.0中的一些操作.内容有: (1)排序 tf.sort().tf.argsort().top_k():(2)填充 tf.pad():(3)复制 tf ...

  7. 【TensorFlow2.0】(6) 数据统计,范数、最值、求和、均值、最值位置、唯一值、张量比较

    各位同学好,今天和大家分享一下TensorFlow2.0中的数据分析操作.内容有: (1)范数 tf.norm():(2)最值 tf.reduce_min(), tf.reduce_max()(3)求 ...

  8. mybatis-plus对datetime返回去掉.0_华为AI认证-TensorFlow2.0编程基础

    参考<HCIA-AI2.0培训教材><HCIA-AI2.0实验手册> 认证要求: 了解TensorFlow2.0是什么以及其特点 掌握TensorFlow2.0基础和高阶操作方 ...

  9. TensorFlow2.0学习

    文章目录 一.TensorFlow的建模流程 1.1 结构化数据建模流程范例 1.1.1 准备数据 1.1.2 定义模型 1.1.3 训练模型 1.1.4 评估模型 1.1.5 使用模型 1.1.6 ...

最新文章

  1. 【Android 逆向】IDA 工具使用 ( 交叉引用数量设置 | 调试设置 )
  2. flaming pear flood中文版
  3. 进程间通信——信号量及ipcs/ipcrm 介绍
  4. 解决ffmpeg拉流转发频繁丢包问题max delay reached. need to consume packet
  5. Effective Java -- 思维导图
  6. C++11 Lambda表达汇总总结
  7. 矩池云上缺少curand.h、cublas_v2.h、cusolverDn.h头文件解决方法
  8. 分享:skalibs 1.3.0 发布,低级的 C 程序库
  9. 需求与商业模式分析-1-商业模式画布
  10. 非线性可视化(2)非线性相图
  11. 一个简单的python例子(监控网页是否运行)
  12. 使用深度学习和物理约束求解偏微分方程
  13. 多智能体系统的分布式协同控制——采样控制、脉冲控制、弹性控制
  14. 偶像的力量-松哥经典语录
  15. 论文阅读(联邦学习):Exploiting Shared Representations for Personalized Federated Learning
  16. 02 who——open、read、close
  17. 运载火箭飞行控制系统设计
  18. 如何查询计算机已连接wife的密码错误,电脑已经连上无线如何查看WIFI密码
  19. Java中的IO、NIO、File、BIO、AIO详解
  20. Android动画合集

热门文章

  1. fcn+caffe+siftflow实验记录
  2. 【转】小屁孩, 懂个啥
  3. 创建ros的程序包--3
  4. Struts2 Action的访问路径
  5. JS组件系列——又一款MVVM组件:Vue(一:30分钟搞定前端增删改查)
  6. Step by Step 使用HTML5开发一个星际大战游戏(1)
  7. JAVA的嵌入式脚本开发(上)
  8. 如何在VB中使用正则表达式
  9. vue 项目中遇到的问题及解决方案
  10. vs2015打开慢的解决方法