tf.concat的用法
import numpy as np
import tensorflow as tf
sess=tf.Session()
a=np.zeros((1,2,3,4))
b=np.ones((1,2,3,4))
c1 = tf.concat([a, b], axis=-1) # 倒数第一维度增加,其它不变
d1=sess.run(c1)
print('d1=',d1)
print('d1.shape=',d1.shape)
c = tf.concat([a, b], axis=-2) #倒数第二维度增加,其它不变
d=sess.run(c)
print('d=',d)
print('d.shape=',d.shape)
a1=np.zeros((3,4))
b1=np.ones((3,4))
c2 = tf.concat([a1, b1], axis=-1) # 如果是二维就和axis=1一样,第2维坐标增加,就是行不变,列增加
d2=sess.run(c2)
print('d2=',d2)
print('d2.shape=',d2.shape)


tf.concat的用法的更多相关文章
- tf.concat, tf.stack和tf.unstack的用法
tf.concat, tf.stack和tf.unstack的用法 tf.concat相当于numpy中的np.concatenate函数,用于将两个张量在某一个维度(axis)合并起来,例如: a ...
- TensorFlow tf.app&tf.app.flags用法介绍
TensorFlow tf.app&tf.app.flags用法介绍 TensorFlow tf.app argparse tf.app.flags 下面介绍 tf.app.flags.FL ...
- 深度学习原理与框架-Alexnet(迁移学习代码) 1.sys.argv[1:](控制台输入的参数获取第二个参数开始) 2.tf.split(对数据进行切分操作) 3.tf.concat(对数据进行合并操作) 4.tf.variable_scope(指定w的使用范围) 5.tf.get_variable(构造和获得参数) 6.np.load(加载.npy文件)
1. sys.argv[1:] # 在控制台进行参数的输入时,只使用第二个参数以后的数据 参数说明:控制台的输入:python test.py what, 使用sys.argv[1:],那么将获得w ...
- tensorflow报错error,tf.concat Expected int32, got list containing Tensors of type '_Message' instead
参考:https://stackoverflow.com/questions/41813665/tensorflow-slim-typeerror-expected-int32-got-list-co ...
- tensorflow 笔记7:tf.concat 和 ops中的array_ops.concat
用于连接两个矩阵: mn = array_ops.concat([a, d], 1) # 按照第二维度相接,shape1 [m,a] shape2 [m,b] ,concat_done shape ...
- 学习TensorFlow的tf.concat使用
https://www.tensorflow.org/api_docs/python/tf/concat
- tensorflow 基本函数(1.tf.split, 2.tf.concat,3.tf.squeeze, 4.tf.less_equal, 5.tf.where, 6.tf.gather, 7.tf.cast, 8.tf.expand_dims, 9.tf.argmax, 10.tf.reshape, 11.tf.stack, 12tf.less, 13.tf.boolean_mask
1. tf.split(3, group, input) # 拆分函数 3 表示的是在第三个维度上, group表示拆分的次数, input 表示输入的值 import tensorflow ...
- MySQL中CONCAT()的用法
MySQL中CONCAT()的用法 在日常开发过程中,特别是在书写接口的时候,经常会遇到字符串拼接的情况,比如在返回图片数据时,数据库里往往存储的是相对路径,而接口里一般是存放绝对地址,这就需要字符串 ...
- 【转载】 TensorFlow tf.app&tf.app.flags用法介绍
作 者:marsggbo 出 处:https://www.cnblogs.com/marsggbo版权声明:署名 - 非商业性使用 - 禁止演绎,协议普通文本 | 协议法律文本. ---------- ...
随机推荐
- GlusterFS常用设置命令
可信存储池(Trusted Storage Pool)创建存储池例如要创建一个包含3个服务器的存储池,则需要从第一个服务器server1中把另外两个服务器加入存储池中:# gluster peer p ...
- [1-2] Dependence-Aware Service Function Chain Design and Mapping
文献名称:Dependence-Aware Service Function Chain Design and Mapping 文献类型(期刊.硕论.博论):会议:Globecom 发表年份:2017 ...
- php如何实现三级分销
Q: 项目要实现三级分销;对于数据库的设计和用户注册后给所有上级(最多三级)返利 但是一点头绪都没有,请大神帮忙给个思路! 如果是直接注册给奖励20元如果是通过二维码或者链接进入的注册页面 找到上级 ...
- [zhuan]SQLSERVER 数据库性能的基本
SQLSERVER 数据库性能的基本 很久没有写文章了,在系统正式上线之前,DBA一般都要测试一下服务器的性能 比如你有很多的服务器,有些做web服务器,有些做缓存服务器,有些做文件服务器,有些做数据 ...
- swap 释放
#swap 释放 -------------------------------- swapoff -a wwapon -a
- systemctl start docker失败,提示start request repeated too quickly for docker.service
情景说明 本来服务器docker服务运行的很好,但客户重启了服务器-于是服务有些问题,遂进入到服务器再次启动docker及服务.不料提示上面的错误-- 解决办法 尝试1 Google了一圈,发现说法很 ...
- python 3环境下,离线安装模块(modules)
说明: 需要在环境中安装python的模块,但是无法联网,就通过在Pypi上下载离线模块的包进行安装 安装过程: 1.下载模块,如PyMySQL-0.9.3.tar.gz,下载地址:https://f ...
- Angular4.0 探索子路由和懒加载 loadChildren
参考文章: Angular4路由快速入门 http://www.jianshu.com/p/e72c79c6968e Angular2文档学习的知识点摘要——Angular模块(NgModule)h ...
- asp.net msbuild 发布
"C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\MSBuild\Current\Bin\msbuild.exe ...
- awk(gawk)文本报告生成器
awk是gawk的链接文件,是一种优良的文本处理工具,实现格式化文本输出,是Linux和Unix现有环境中功能最强大的数据处理引擎之一.这种编程及数据操作语言的最大功能取决于一个人拥有的知识量,使用& ...