![](https://img-blog.csdnimg.cn/20201014180756926.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
TensorFlow
文章平均质量分 64
jasonzzj
这个作者很懒,什么都没留下…
展开
-
TensorFlow多GPU并行计算
1. TensorFlow指定特定GPU或者CPU进行计算:说明:示例计算机为单CPU(编号为0),单GPU(编号为0),安装的TensorFlow为GPU版。本文的结构如下:默认为GPU #0指定CPU #0指定GPU #1指定GPU #0 + CPU #01.1 默认为GPU #0In [1]: import tensorflow as tfI tensorflow/stream_ex原创 2016-09-19 19:11:32 · 14298 阅读 · 0 评论 -
TensorFlow从图像提取区域的函数
tf.image.extract_glimpse(input, size, offsets, centered=None, normalized=None, uniform_noise=None, name=None)tf.image.crop_to_bounding_box(image, offset_height, offset_width, target_height, target_wid原创 2017-03-08 00:59:29 · 5241 阅读 · 0 评论 -
softmax 带 tempreture 参数
softInput = tf.matmul(output, Wl_h_l) + Bl_h_l softmaxLoc = tf.nn.softmax(softInput / tempreture)在tensorflow中这样用,其他的库均类似~原创 2017-03-05 16:44:08 · 2236 阅读 · 1 评论 -
RNN中输出端的sample采样
在Theano中,有如下定义的函数可供sequence to sequence 模型来使用sample功能:def sample(preds, temperature=1.0): # function to sample an index from a probability array # temperature = (0, 1.0] # https://github原创 2017-03-04 16:13:59 · 2655 阅读 · 0 评论 -
Tensorflow 中 RNN softmax输出层采样 tf.multinomial(logits, num_samples)
Tensorflow 中,想要使用sequence to sequence 模型,在RNN的输出端采样(sampling),可以在softmax层之后,做简单的log p 再用tf.multinomial()来实现:tf.multinomial(logits, num_samples, seed=None, name=None)例如:# samples has shape [1, 5原创 2017-03-04 16:21:46 · 7617 阅读 · 2 评论 -
TensorFlow用expand_dim()来增加维度
TensorFlow中,想要维度增加一维,可以使用tf.expand_dims(input, dim, name=None)函数。当然,我们常用tf.reshape(input, shape=[])也可以达到相同效果,但是有些时候在构建图的过程中,placeholder没有被feed具体的值,这时就会包下面的错误:TypeError: Expected binary or unicode strin原创 2017-03-08 00:41:01 · 80371 阅读 · 10 评论 -
Tensorflow 的tf.one_hot()功能:dense to one hot
import tensorflow as tfindices = [[3], [5], [0], [7]]indices = tf.concat(0, indices)indices = tf.reshape(indice, (4, 1))a = tf.one_hot(indices, depth=10, on_value=None, off_value=None, axis=None,原创 2017-03-04 16:04:41 · 20721 阅读 · 0 评论 -
Tensorboard 上显示不同训练模型曲线的方法
$ tensorboard --logdir=run1:"/home/.../summary",run2:"/home/.../summary" --port=6006原创 2017-03-03 10:04:36 · 8803 阅读 · 0 评论 -
tensorflow 使用多块GPU同时训练多个模型
转自:http://stackoverflow.com/questions/34775522/tensorflow-mutiple-sessions-with-mutiple-gpusTensorFlow will attempt to use (an equal fraction of the memory of) all GPU devices that are visible t转载 2017-03-01 10:20:57 · 8887 阅读 · 0 评论 -
TensorFlow 使用——tf.image.extract_glimpse(input, size, iffsets, centered, normalized)
tf.image.extract_glimpse(input, size, offsets, centered=None, normalized=None, uniform_noise=None, name=None) {#extract_glimpse}Extracts a glimpse from the input tensor.Returns a set of wind原创 2017-02-28 11:28:11 · 1919 阅读 · 0 评论 -
Tensorflow中padding的两种类型SAME和VALID
SAME means that the output feature map has the same spatial dimensions as the input feature map. Zero padding is introduced to make the shapes match as needed, equally on every side of the input ma...转载 2016-12-29 16:46:55 · 42677 阅读 · 2 评论 -
Resnet的Tensorflow实现源代码
Importimport skimage.io # bug. need to import this before tensorflowimport skimage.transform # bug. need to import this before tensorflowimport tensorflow as tffrom tensorflow.python.ops import co原创 2016-12-28 21:52:33 · 10585 阅读 · 0 评论 -
在Windows下直接安装Tensorflow的Windows版本
在Windows下直接安装TensorFlow原创 2016-12-06 18:15:36 · 11131 阅读 · 2 评论 -
Linux下监视NVIDIA的GPU使用情况
在使用TensorFlow跑深度学习的时候,经常出现显存不足的情况,所以我们希望能够随时查看GPU时使用率。如果你是Nvidia的GPU,那么在命令行下,只需要一行命令就可以实现。1. 显示当前GPU使用情况Nvidia自带了一个nvidia-smi的命令行工具,会显示显存使用情况:$ nvidia-smi输出: 2. 周期性输出GPU使用情况但是有时我们希望不仅知道那一固定时刻的GPU使用情况,原创 2016-09-24 11:11:57 · 191015 阅读 · 18 评论 -
TensorFlow之函数:reduce_mean() 来自于numpy.mean()
本文介绍了tensorflow和numpy中的以下两个函数1. tf.reduce_mean()2. np.mean()原创 2016-11-10 12:05:22 · 23395 阅读 · 0 评论 -
Convolutional Networks for MNIST in Tensorflow
写在前面本文介绍了使用TensorFlow在MNIST数据集上构建基础的卷积神经网络来实现识别手写字符的任务,包括:{两层的卷基层}+{一层relu的全链接层}+{一层softmax的全链接层}。由于结构简单,代码清晰,文章整体就以代码走向为主,阅读省力省事。1. Load MNIST Data# load MNIST datafrom tensorflow.examples.tutorials.原创 2016-09-23 16:40:46 · 1290 阅读 · 1 评论 -
TensorFlow 安装及问题解决
TensorFlow 为 Google 开源的新一代深度学习框架,与之前使用的Caffe和Torch基于层的设计理念有所不同,是基于张量流图的设计思路,这也是今后深度学习框架的一大发展趋势。本文默认您的linux计算机已经安装有Python下面介绍一下安装与安装遇到的问题及解决方法。将包含下列内容:CUDA-7.5 与 cuDNN v.5 安装pip安装TensorFlow 安装安装成功测试问题和解决方案原创 2016-09-19 11:01:08 · 27044 阅读 · 12 评论