tf.expand_dims
想要增加一维,可以使用tf.expand_dims(input, dim, name=None)函数
t = np.array(np.arange(1, 1 + 30).reshape([2, 3, 5]), dtype=np.float32)
array([[[ 1., 2., 3., 4., 5.],
[ 6., 7., 8., 9., 10.],
[11., 12., 13., 14., 15.]], [[16., 17., 18., 19., 20.],
[21., 22., 23., 24., 25.],
[26., 27., 28., 29., 30.]]], dtype=float32) t0=tf.expand_dims(t, 0)--------------<tf.Tensor 'ExpandDims_2:0' shape=(1, 2, 3, 5) dtype=float32>
t1=tf.expand_dims(t, 1)--------------<tf.Tensor 'ExpandDims_3:0' shape=(2, 1, 3, 5) dtype=float32>
t2=tf.expand_dims(t, 2)--------------<tf.Tensor 'ExpandDims_4:0' shape=(2, 3, 1, 5) dtype=float32>
t3=tf.expand_dims(t, 3)--------------<tf.Tensor 'ExpandDims_4:0' shape=(2, 3, 1, 5) dtype=float32>
t4=tf.expand_dims(t, 4)--------------报错
tf.expand_dims的更多相关文章
- tensorflow 笔记14:tf.expand_dims和tf.squeeze函数
tf.expand_dims和tf.squeeze函数 一.tf.expand_dims() Function tf.expand_dims(input, axis=None, name=None, ...
- tf.expand_dims 来增加维度
主要是因为tflearn官方的例子总是有embeding层,去掉的话要conv1d正常工作,需要加上expand_dims network = input_data(shape=[None, 100] ...
- 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 ...
- tf.expand_dims和tf.squeeze函数
from http://blog.csdn.net/qq_31780525/article/details/72280284 tf.expand_dims() Function tf.expand_d ...
- 图融合之加载子图:Tensorflow.contrib.slim与tf.train.Saver之坑
import tensorflow as tf import tensorflow.contrib.slim as slim import rawpy import numpy as np impor ...
- TF常用知识
命名空间及变量共享 # coding=utf-8 import tensorflow as tf import numpy as np import matplotlib.pyplot as plt; ...
- 深度学习原理与框架-CNN在文本分类的应用 1.tf.nn.embedding_lookup(根据索引数据从数据中取出数据) 2.saver.restore(加载sess参数)
1. tf.nn.embedding_lookup(W, X) W的维度为[len(vocabulary_list), 128], X的维度为[?, 8],组合后的维度为[?, 8, 128] 代码说 ...
- 深度学习原理与框架-递归神经网络-RNN_exmaple(代码) 1.rnn.BasicLSTMCell(构造基本网络) 2.tf.nn.dynamic_rnn(执行rnn网络) 3.tf.expand_dim(增加输入数据的维度) 4.tf.tile(在某个维度上按照倍数进行平铺迭代) 5.tf.squeeze(去除维度上为1的维度)
1. rnn.BasicLSTMCell(num_hidden) # 构造单层的lstm网络结构 参数说明:num_hidden表示隐藏层的个数 2.tf.nn.dynamic_rnn(cell, ...
- tf一些函数
1. tf.reduce_mean(a) : 求平均值 2. tf.truncated_normal([3,2],stddev=0.1) : 从正态分布中输出随机值,标准差为0,1,构造矩阵为3*2的 ...
随机推荐
- UVALive 6862 Triples (找规律 暴力)
Triples 题目链接: http://acm.hust.edu.cn/vjudge/contest/130303#problem/H Description http://7xjob4.com1. ...
- spring- junit测试事务回滚
http://blog.csdn.net/molingduzun123/article/details/49383235
- 前端学习记录 week 1
前端学习记录 week 1 基础知识 CSS盒模型 所有HTML元素可以看作盒子,在CSS中,"box model"这一术语是用来设计和布局时使用.CSS盒模型本质上是一个盒子,封 ...
- JS - 事件循环和任务队列
栈.堆和队列 栈:函数调用形成栈 堆:对象的内容分配在堆中 队列:一个 JavaScript 运行时包含了一个待处理的消息队列.在事件循环期间依次处理队列中的消息 事件循环 之所以称之为事件循环,是因 ...
- flex 强制垃圾回收
java和flash的垃圾回收都是一个比较热门的话题,今天我也用一个例子来测试下flash的强制垃圾回收.主要用到的而一个类是LocalConnection. 在Flash player的debug版 ...
- Linux_NIS+NFS+Autofs
目录 目录 前言 NIS NFS Autofs 搭建NISNFSAutofs Setup NNA environment Setup ServerSite Setup client 前言 NIS+NF ...
- 阶段1 语言基础+高级_1-3-Java语言高级_06-File类与IO流_05 IO字符流_2_字符输入流读取字符数据
读取的文件有中文也有英文 强转为char类型 缓冲读取多个字符 使用string的构造方法转换为字符输出
- Raudus入门(1)
Raudus入门(1) (2013-08-09 14:38:17) 转载▼ 标签: it 分类: Delphi 基于delphi做web应用,有个Raudus,基于对ext js的封装,可以在delp ...
- Tclientdataset的CloneCursor问题 clientdataset 复制 赋值 的问题
http://www.myexception.cn/delphi/720245.html Tclientdataset的CloneCursor问题我的DBGRID所连接的数据源为cdsBook,然后用 ...
- [转载]X509证书中RSA公钥的提取与载入 pem key
原地址:https://blog.csdn.net/anddy926/article/details/8940377 由于项目需要,我计划利用openssl开发一个基本的CA,实现证书的发放等功能.在 ...