
tensorflow
Mr番茄蛋
大家一起学习
展开
-
本地浏览器查看服务器开启的tensorboard结果
使用xshell连接服务器,开启tensorboard,使用本地浏览器查看图表。1. xshell操作服务器ssh -L 16006:127.0.0.1:6006 name@ip # 你的用户名和ipexport LC_ALL=Ctensorboard --logdir=xxx --port=60062. 本地浏览器在本地浏览器中访问http://127.0.0.1:16006/...原创 2019-10-29 13:45:43 · 2480 阅读 · 3 评论 -
tensorflow函数tf.segment_max,tf.nn.top_k使用小记
import tensorflow as tfsegment_ids=tf.constant([0,0,0,1,1,2])v=tf.Variable([5.,2.,3.,6.,1.,2.])m=tf.segment_max(v,segment_ids)top=tf.nn.top_k(v,k=2,sorted=False)[0]with tf.Session() as sess: ...原创 2018-08-09 15:23:44 · 1376 阅读 · 0 评论 -
LSTM输入输出详解,tensorflow.nn.bidirectional_dynamic_rnn()函数的用法
LSTM结构 参数介绍: 数学原理: 公式参数: xt∈Rdxt∈Rd{\displaystyle x_{t}\in \mathbb {R} ^{d}}: input vector to the LSTM unit ft∈Rhft∈Rhft∈Rhft∈Rh{\displaystyle f_{t}\in \mathbb {R} ^{h}} {\displaystyle f_{t...原创 2018-08-01 16:16:21 · 17824 阅读 · 1 评论 -
tf.einsum()简单使用
tf.einsumeinsum( equation, *inputs) 一般来说, 方程是从较熟悉的元素方程得到:删除变量名称、括号和逗号; 用 “*” 替换 “,”; 删除总和标志; 将输出移到右侧,并将 “=” 替换为 “->>”。 许多常见操作可以用这种方式来表示。例如:# Matrix multiplication>>> eins...原创 2018-08-10 11:16:53 · 27397 阅读 · 3 评论 -
tensorflow tf.tile使用
import tensorflow as tftemp = tf.tile([1,2,3],[2])temp2 = tf.tile([[1,2],[3,4],[5,6]],[2,3])with tf.Session() as sess: print(sess.run(temp)) print(sess.run(temp2))# out[1 2 3 1 2 3][[1...原创 2018-09-04 16:42:43 · 377 阅读 · 0 评论 -
TensorFlow协方差attention
a=tf.constant([[[0.1,0.2,0.5,0.2], [0.1,0.1,0.1,0.7]], [[0.2,0.3,0.2,0.3], [0.2,0.2,0.2,0.4]]])d=a.shape.as_list()[-1]d=tf.constant(d,dtype=tf.float3...原创 2018-09-05 21:41:12 · 1167 阅读 · 1 评论 -
tf.AUTO_REUSE作用
概述在tensorflow中,为了 节约变量存储空间 ,我们常常需要通过共享 变量作用域(variable_scope) 来实现 共享变量 。大家比较常用也比较笨的一种方法是,在重复使用(即 非第一次使用)时,设置 reuse=True 来 再次调用 该共享变量作用域(variable_scope)。但是这种方法太繁琐了。有种更简洁 的方法来一次性对variable_scope进行re...原创 2018-09-06 22:27:55 · 22771 阅读 · 2 评论 -
tf.varible_scope()和tf.AUTO_REUSE
class G(): def __init__(self): with tf.variable_scope('a'): self.a=tf.Variable([[[0.1,0.2,0.5,0.2], [0.1,0.1,0.1,0.7]], [[0.2,0.3,0.2,0.3], ...原创 2018-09-07 10:33:25 · 4347 阅读 · 0 评论 -
TensorFlow学习记录
tf.stack和tf.unstack解析:tf.stackstack(values, axis=0, name='stack')#假如'x'为[1, 4],'y'为[2, 5],'z'为[3, 6],#那么:tf.stack([x, y, z]) => [[1, 4], [2, 5], [3,6]],tf.stack([x, y, z], axis=1) =>...原创 2018-09-13 15:35:24 · 202 阅读 · 0 评论 -
tf.clip_by_global_norm使用
在用bilstm+crf训练命名实体识别时,采用梯度修剪策略,最小化损失with tf.variable_scope('crf'): self.log_likelihood, self.transition_params = crf.crf_log_likelihood(inputs=self.logits,tag_indices=self.targets,sequence_length...原创 2018-11-04 15:09:33 · 689 阅读 · 0 评论 -
博客、教程收集
深度学习Implementing a CNN for Text Classification in TensorFlowUnderstanding Convolutional Neural Networks for NLPRNNs in Tensorflow, a Practical Guide and Undocumented FeaturesAttention and Memory...原创 2018-07-31 12:36:31 · 343 阅读 · 0 评论 -
https://zhuanlan.zhihu.com/p/22252270
https://zhuanlan.zhihu.com/p/22252270转载 2018-07-25 17:29:34 · 4880 阅读 · 0 评论 -
tensorflow中tf.dynamic_rnn使用,outputs和state理解
tf.dynamic_rnntensorflow 的dynamic_rnn,我们用一个小例子来说明其用法,假设你的RNN的输入input是[2,3,4],其中2是batch_size,3是文本最大长度,一般叫num_steps或者seq_length,4是embedding_size。我们假设第二个文本长度只有2,剩下的1个是使用0-padding方法填充的。dynamic_rnn返回的是...原创 2018-03-15 19:36:43 · 7351 阅读 · 1 评论 -
tensorflow中四种不同交叉熵函数tf.nn.softmax_cross_entropy_with_logits()
Tensorflow中的交叉熵函数tensorflow中自带四种交叉熵函数,可以轻松的实现交叉熵的计算。tf.nn.softmax_cross_entropy_with_logits() tf.nn.sparse_softmax_cross_entropy_with_logits() tf.nn.sigmoid_cross_entropy_with_logits() tf...原创 2018-03-31 22:20:53 · 21904 阅读 · 6 评论 -
TensorFlow中张量增加纬度和词向量查找一些操作
TensorFlow中embedding_lookup操作import tensorflow as tfa=tf.Variable(tf.random_normal([2,4]),tf.float32)b=tf.Variable(tf.random_normal([2,3]),tf.float32)c=tf.Variable(tf.random_normal([2,3]),tf.float...原创 2018-04-15 14:09:14 · 1022 阅读 · 0 评论 -
TensorFlow中常用函数说明
本文主要对TensorFlow的一些常用概念与方法进行描述,TensorFlow常用函数如下:转载地址:https://blog.youkuaiyun.com/lenbow/article/details/521527662、tf函数操作组 操作Maths Add, Sub, Mul, Div, Exp, Log, Greater, Less, EqualArray Concat, Slice, Spl...转载 2018-04-16 18:26:25 · 1708 阅读 · 0 评论 -
已解决:用anaconda安装最新的TensorFlow版本
用anaconda安装最新的TensorFlow版本存在问题: 一般从anaconda官网下载的anaconda,查看tensorflow依然还是1.2的版本,现在用conda更新TensorFlow解决方法: 1,打开anaconda-prompt2,查看tensorflow各个版本:(查看会发现有一大堆TensorFlow源,但是不能随便选,选择可以用查找命令定位)anaconda searc...原创 2018-04-16 20:01:59 · 25324 阅读 · 4 评论 -
tensorflow中将label索引转换成one-hot形式
import tensorflow as tfindex=[0,1,2,3]one_hot=tf.one_hot(index,5)with tf.Session() as sess: sess.run(tf.global_variables_initializer()) print(sess.run(one_hot))原创 2018-04-18 21:38:55 · 12320 阅读 · 2 评论 -
TensorFlow实现卷积,tf.nn.conv2d介绍
tf.nn.conv2d是TensorFlow里面实现卷积的函数,参考文档对它的介绍并不是很详细,实际上这是搭建卷积神经网络比较核心的一个方法,非常重要 tf.nn.conv2d(input, filter, strides, padding, use_cudnn_on_gpu=None, name=None) 除去name参数用以指定该操作的name,与方法有关的一共五个参数: inp...原创 2018-07-24 21:59:33 · 408 阅读 · 0 评论 -
TensorFlow的tf.nn.max_pool池化操作实现讲解
tf.nn.max_poolmax pooling是CNN当中的最大值池化操作,其实用法和卷积很类似tf.nn.max_pool(value, ksize, strides, padding, name=None) 参数是四个,和卷积很类似: value:需要池化的输入,一般池化层接在卷积层后面,所以输入通常是feature map,依然是[batch, height, width, ...原创 2018-07-25 15:31:03 · 2422 阅读 · 0 评论