![](https://img-blog.csdnimg.cn/20201014180756925.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
TensorFlow
文章平均质量分 76
TensorFlow
西笑生
西笑生
展开
-
TensorFlow reduce_sum
TensorFlow reduce_sumflyfish import numpy as npimport tensorflow as tfx = np.array([[1,2,3],[4,5,6]])sess = tf.Session()sum0 = np.sum(x, axis=0)sum1 = np.sum(x, axis=1)sum2 = sess.run(tf.reduce_sum(原创 2017-01-21 16:00:54 · 3572 阅读 · 0 评论 -
TensorFlow - Toeplize 矩阵(托普利兹矩阵)
TensorFlow - Toeplize 矩阵(托普利兹矩阵)flyfish卷积运算可以构造一个矩阵乘法,将其中一个输入转换成一个Toeplitz矩阵Toeplize 矩阵是什么样的 ⎡⎣⎢⎢⎢⎢⎢⎢afghibafghcbafgdcbafedcba⎤⎦⎥⎥⎥⎥⎥⎥\begin{bmatrix}a & b & c & d & e \\f & a & b & c & d \\g & f &原创 2017-08-25 11:20:21 · 4152 阅读 · 1 评论 -
TensorFlow - 激活函数
TensorFlow - 激活函数flyfish激活函数(Activation function)目标是为神经网络引入非线性。评价某个激活函数是否有用时,可考虑下列为数不多的几个主要因素。 1)该函数应是单调的,这样输出便会随着输入的增长而增长,从而使利用梯度下降法寻找局部极值点成为可能。 2)该函数应是可微分的,以保证该函数定义域内的任意一点上导数都存在,从而使得梯度下降法能够正常使用来自这类原创 2017-09-22 16:04:03 · 1028 阅读 · 0 评论 -
TensorFlow - Tensor理解与使用
如何理解TensorFlow中的tensorflyfishtensor 张量 英 [‘tensə; -sɔː] 美 [‘tɛnsɚ]What is a Tensor? Tensors are simply mathematical objects that can be used to describe physical properties, just like scalars an原创 2017-05-30 11:33:33 · 8403 阅读 · 2 评论 -
TensorFlow - 编译TensorFlow
TensorFlow - 编译TensorFlowflyfish环境 Win7 Microsoft Visual Studio 2017 Community Anaconda3*(Python3.5) swig Git cmaketensorflow源码的所在目录是E:\lib\tensorflow依次执行 “E:\Program Files (x86)\Microsoft Visu原创 2017-08-04 17:19:02 · 2869 阅读 · 0 评论 -
TensorFlow - tf.multiply和tf.matmul 区别
TensorFlow - tf.multiply和tf.matmul 区别flyfish# a# [[1, 2, 3],# [4, 5, 6]] a = tf.constant([1, 2, 3, 4, 5, 6], shape=[2, 3])# b1# [[ 7, 8],# [ 9, 10],# [11, 12]] b1 = tf.constant([7, 8,原创 2018-01-23 16:50:21 · 18552 阅读 · 1 评论 -
TensorFlow - 卷积
TensorFlow - 卷积flyfish假设平面坐标轴有一条线,函数 f(x)=x√f(x) = \sqrt {x} ,x的定义域是[0,1]假设求由 y=f(x),x=a,x=b,与x轴所围成的曲边梯形的面积 面积是 0.2−−−√(0.2−0)+0.4−−−√(0.4−0.2)+⋯+1√(1−0.8).{\displaystyle \textstyle {\sqrt {0.2}}\原创 2017-08-22 17:19:47 · 717 阅读 · 0 评论 -
TensorFlow - tf.nn.conv2d
TensorFlow - tf.nn.conv2dflyfish函数说明原文 tf.nn.conv2d(input, filter, strides, padding, use_cudnn_on_gpu=None, name=None)Computes a 2-D convolution given 4-D input and filter tensors.Given an input tenso原创 2017-08-23 17:30:10 · 3973 阅读 · 0 评论 -
TensorFlow - 编译Protocol Buffers
Windows下编译Protocol Buffersflyfish环境 CMake,Visual Studio 20131 CMake配置如图 支持xpCMAKE_INSTALL_PREFIX=../../../../install执行Config,General 最后生成如下 2 执行E:\lib\protobuf\VS 目录里的extract_includes.bat所需头文件会拷贝到此文原创 2017-07-03 10:42:49 · 603 阅读 · 0 评论 -
TensorFlow - Google C++ 测试框架
TensorFlow - Google C++ 测试框架flyfish环境:Win7,Visual Studio 2013下载之后 源码文件夹 一个是googletest,一个是googlemock 这里使用的是googletestLib生成 使用Visual Studio 2013编译 E:\lib\googletest\googletest\msvc 这里编译的是gtest.sln配原创 2017-08-09 17:35:31 · 1505 阅读 · 0 评论 -
TensorFlow - 读取CSV格式文件
TensorFlow - 读取CSV格式文件flyfish以TensorFlow提供的例子说明filename_queue = tf.train.string_input_producer(["file0.csv", "file1.csv"])reader = tf.TextLineReader()key, value = reader.read(filename_queue)# Default原创 2017-09-14 16:30:55 · 1436 阅读 · 0 评论 -
TensorFlow - 神经网络
TensorFlow - 神经网络flyfishTensorFlow的图 Andrew Ng的介绍神经网络是在模仿大脑中的神经元或者神经网络。神经元是一个计算单元,它从输入神经接受一定数目的信息并做一些计算然后将结果通过它的轴突传送到其他节点或者大脑中的其他神经元。一是神经元有细胞主体, 二是神经元有一定数量的输入神经,这些输入神经叫做树突。可以把它们想象成输入电线,它们接收来自其他神经元的信息原创 2017-09-27 16:20:31 · 468 阅读 · 0 评论 -
TensorFlow - 矩阵
TensorFlow - 矩阵flyfish矩阵 A=⎡⎣⎢−1.320.49.70.65.5−6.2⎤⎦⎥\mathbf {A} ={\begin{bmatrix}-1.3&0.6\\20.4&5.5\\9.7&-6.2\end{bmatrix}}A=⎡⎣⎢⎢⎢⎢⎢a11a21⋮am1a12a22⋮am2⋯⋯⋱⋯a1na2n⋮amn⎤⎦⎥⎥⎥⎥⎥=⎛⎝⎜⎜⎜⎜⎜a11a21⋮am1a12a22⋮原创 2017-08-03 14:45:41 · 796 阅读 · 1 评论 -
TensorFlow - 生成艺术画
TensorFlow - 生成艺术画flyfish预备工作Win7 64 python3 TensorFlow准备代码与数据neural-style代码https://github.com/anishathalye/neural-stylevgg19数据文件文件名是imagenet-vgg-verydeep-19.mat 该文件放到neural-style的主目录命令进入命令行 进入neur原创 2017-09-07 10:57:57 · 1968 阅读 · 0 评论 -
TensorFlow - Ubuntu下最简便的安装
TensorFlow - Ubuntu下最简便的安装flyfish通过Anaconda安装1浏览器下载 下载Anaconda3-4.4.0-Linux-x86_64.sh 自动下载到 Downloads目录2安装Anaconda 在终端输入:cd ~/Downloadsbash Anaconda3-4.4.0-Linux-x86_64.sh 3查看安装包 anaconda search -t c原创 2017-08-15 14:23:13 · 547 阅读 · 0 评论 -
TensorFlow - Softmax
TensorFlow - Softmaxflyfish公式 sigma(z)j=ezj∑Kk=1ezksigma(z)j=ezj∑k=1Kezksigma (\mathbf {z} )_{j}={\frac {e^{z_{j}}}{\sum _{k=1}^{K}e^{z_{k}}}}解释 K表示K维向量 类似一个向量里面有K个实数值,通过Softmax函数输出另一个向量,另一个向量...原创 2017-09-19 15:18:42 · 1057 阅读 · 0 评论 -
TensorFlow - 识别物体
TensorFlow - 识别物体flyfish环境 Win7 x64 Python3 TensorFlowinception-2015-12-05.tgz 下载地址 models源码文件 只用其中一个,目录是 \tutorials\image\imagenet\classify_image.py 执行命令python classify_image.py --model_dir /t原创 2017-09-18 17:36:12 · 1554 阅读 · 0 评论 -
TensorFlow - 生成数据
TensorFlow - 生成数据flyfishzeros是生成0的矩阵 ones是生成1的矩阵 tf.zeros([3]) 输出 [ 0. 0. 0.]tf.zeros([3,2]) 输出 [[ 0. 0.] [ 0. 0.] [ 0. 0.]]tf.zeros([3,3,3]) 输出 [[[ 0. 0. 0.] [ 0. 0. 0.] [ 0.原创 2017-09-21 15:16:19 · 777 阅读 · 0 评论 -
TensorFlow - 使用Protocol Buffers
VC下使用protobufflyfish1根据定义格式文件生成C++的头文件和生成文件E:\lib\protobuf\VS\Debug\protoc.exe为了路径简化,将addressbook.proto拷贝到E:\test 执行命令 protoc -I=E:\test –cpp_out=E:\test E:\test\addressbook.proto生成两个文件 addressbook.p原创 2017-07-03 14:15:32 · 1405 阅读 · 0 评论 -
TensorFlow - 卷积的手工计算方法
TensorFlow - 卷积的手工计算方法flyfishimport tensorflow as tfsess = tf.InteractiveSession()input = tf.constant([ [ [[1.0], [2.0], [3.0]], [[4.0], [5.0], [6.0]],原创 2017-08-26 15:47:15 · 2518 阅读 · 0 评论 -
TensorFlow - 标准存储格式TFRecord
TensorFlow - 标准存储格式TFRecordflyfish文本内容包括 1协议格式的说明 2如何将文件生成标准存储格式TFRecordTFRecord是一个存储着基于Protobuf结构化信息的二进制文件。协议说明 协议所在路径 tensorflow\tensorflow\core\example\feature.protosyntax = "proto3";option cc_原创 2017-08-19 10:38:30 · 1655 阅读 · 0 评论 -
TensorFlow - 多元函数的极值
TensorFlow - 多元函数的极值flyfishpython实现设函数z=f(x,y)z=f(x,y)在点(x0,y0)(x_{0},y_{0})的某个邻域内有定义,对于该邻域内异于的点, 如果都适合不等式 f(x,y)>f(x0,y0)f(x,y)>f(x_{0},y_{0}), 则称函数在点有极大值。 如果都适合不等式 f(x,y)<f(x0,y0)f(x, y)<f(x_{0}原创 2017-09-05 15:08:53 · 3317 阅读 · 0 评论 -
TensorFlow - 求导
函数flyfish定义域是关于输入的上域是关于输出的值域实际上是上域的一个子集上域是可能输出的集合值域则是实际输出的集合.[a, b] 这种形式表示的区间我们称作闭区间. (a, b) 这种形式表示的区间称作开区间. (a, b] 包括 b, 但不包括 a.像这样的区间称作半开区间. 反函数 函数f 的反函数, 并写作 f -1 如果 f (x) = y, 那么 f -1 (y) = x原创 2017-07-27 17:32:27 · 3209 阅读 · 0 评论 -
TensorFlow - 使用TensorFlow开发程序编译环境配置
TensorFlow - 使用TensorFlow开发程序编译环境配置flyfish环境:Win7,Microsoft Visual Studio 2017 Community,平台x64 语言:C++编译器配置如下C\C++-》 常规-》附加包含目录 E:\lib\tensorflow E:\lib\tensorflow\tensorflow\contrib\cmake\build E:\原创 2017-08-05 17:27:22 · 5687 阅读 · 1 评论 -
TensorFlow - 正弦曲线
TensorFlow - 正弦曲线flyfish正弦曲线( sine wave or sinusoid) y=Asin(ωx+φ)y = A\sin(\omega x + \varphi)一个标准图形sin(x) python 代码import matplotlib.pyplot as pltimport numpy as npx = np.linspace(-10, 10, 100)原创 2017-09-07 17:18:48 · 2403 阅读 · 0 评论 -
TensorFlow - 保存和加载训练过程
TensorFlow - 保存和加载训练过程flyfish保存训练过程以线性回归为例import numpy as npimport tensorflow as tf# 线性回归模型 y = Wx + bx = tf.placeholder(tf.float32, [None, 1])W = tf.Variable(tf.zeros([1,1]))b = tf.Variable(tf.zer原创 2017-09-20 20:35:55 · 480 阅读 · 0 评论 -
TensorFlow中的深度优先搜索(Depth-first search, DFS)
TensorFlow中的深度优先搜索(Depth-first search, DFS)flyfish《数据结构、算法与应用:C++语言描述》 深度优先搜索(Depth-first search, DFS)从顶点v 出发,DFS按如下 过程进行:首先将v 标记为已到达顶点,然后选择一个与v 邻接的尚未到达的顶点u,如果这样 的u 不存在,搜索中止。假设这样的u 存在,那么从u 又开始一原创 2017-06-03 16:50:28 · 1232 阅读 · 0 评论