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的 ...
随机推荐
- UIWebView 禁止检测链接弹出UIActionSheet
解决方法一: 添加以下代码禁止检测类型 webView.dataDetectorTypes = UIDataDetectorTypeNone; 解决方法二: - (void)webViewDidFin ...
- SQL 多表查询的几种连接方式
--创建数据库 create database GoodsSystem go --使用数据库 use GoodsSystem go --创建商品类型表 create table GoodsType ( ...
- 《SQL Server 2012 T-SQL基础》读书笔记 - 2.单表查询
Chapter 2 Single-Table Queries GROUP BY之后的阶段的操作对象就是组(可以把一组想象成很多行组成的)了,HAVING负责过滤掉一些组.分组后的COUNT(*)表示每 ...
- 学习C#20天有感
自学C#有20多天了,期间出差去深圳一周,每天平均学习4小时左右,看书+视频,之前有点C语言基础(仅限于基础哈哈),计划30内把C#的基本语法和SQL的基本语法熟悉,把面向对象相对深入的理解一些,然后 ...
- 职位-CHO:CHO
ylbtech-职位-CHO:CHO 首席人力资源官(Chief Human Resource Officer),简称CHO.是具有制定集团化经营的公司人力资源的战略规划,并监督执行,负责建立畅通的沟 ...
- Node - 模块加载与 lerna 提升
从node_modules 加载模块的过程 如果要加载的模块非核心模块,并且路径不是'/'. '../'和'./'开头,这个模块就会从当前文件夹递归向上在node_modules文件夹中寻找这个模块. ...
- Firefox,Chrome使用
Firefox 插件 REDIRECTOR Automatically redirect pages based on user-defined rules. 根据用户定义的规则自动重定向页面的插件. ...
- 用Vue来实现音乐播放器(十八):右侧快速入口点击高亮
问题一:当我们点击右侧快速入口的时候 被点击的地方高亮 首先我们要知道右侧快速入口是为什么高亮??因为当watch()监控到scrollY的变化了的时候 将scrollY的值和listHeight ...
- jenkins打包ios 报错rror: No signing certificate "iOS Distribution" found: No "iOS Distribution...
错误提示如图: error: No signing certificate "iOS Distribution" found: No "iOS Distribution& ...
- VMware 虚拟化编程(6) — VixDiskLib 虚拟磁盘库详解之二
目录 目录 前文列表 VixDiskLib 虚拟磁盘库 VixDiskLib_Open 打开 VMDK File VixDiskLib_Read 读取 VMDK File 数据 VixDiskLib_ ...