TensorFlow学习日记1

1. 什么是Docker Toolbox

Docker Toolbox可以安装你在开发中运行Docker时所需要的一切,包括Docker客户端、Compose、Kitematic、Machine以及VirtualBox等。Docker Toolbox使用Machine和VirtualBox在虚拟机中创建了一个引擎来运行容器。在该虚拟机上,你可以使用Docker客户端、Compose以及Kitematic来运行容器。具体组件,如下所示:

(1)Docker Client for Windows

(2)Docker Machine for Windows

(3)Docker Compose for Windows

(4)VirtualBox

(5)Kitematic for Windows (Alpha)

(6)Git for Windows

说明:因为VirtualBox一直启动失败,所以放弃Docker Toolbox,转而使用Docker for Windows。

 

2. 安装和配置Docker for Windows [2]

解析:

(1)开启Windows 10中的Hyper-V。

(2)在Docker Daemon中设置http://xxxxxxx.m.daocloud.io。 

 

3. 安装和配置TensorFlow

解析:

(1)docker pull tensorflow/tensorflow:0.12.0-rc1

 

4. Python 2.7 + TensorFlow(GPU)

解析:

sudo pip install --ignore-installed --upgrade \

https://storage.googleapis.com/tensorflow/linux/gpu/tensorflow_gpu-1.2.1-cp27-none-linux_x86_64.whl

 

5. SWIG(Simplified Wrapper and Interface Generator)[4][5]

解析:SWIG可将C/C++代码与任何主流脚本语言相集成。

 

6. Bazel(Google)[6] 

解析:Bazel类似于Make的构建工具。

 

7. SIMD单指令多数据指令集

解析:MMX/SSE/AVX/3DNow!/NEON等。

 

8. ptmalloc,tcmalloc和jemalloc [7]

解析:

(1)glibc的ptmalloc

(2)goolge的tcmalloc和jemalloc

 

9. TFLearn 

解析:Deep learning library featuring a higher-level API for TensorFlow.

 

10. tf.constant

解析:constant(value, dtype=None, shape=None, name='Const', verify_shape=False)

(1)value: A constant value (or list) of output type dtype.

(2)dtype: The type of the elements of the resulting tensor.

(3)shape: Optional dimensions of resulting tensor.

(4)name: Optional name for the tensor.

(5)verify_shape: Boolean that enables verification of a shape of values.

 

11. TensorFlow随机数生成函数

解析:

(1)tf.random_normal:正态分布(平均值,标准差,取值类型)。

(2)tf.truncated_normal:正态分布,但如果随机出来的值偏离平均值超过2个标准差,那么这个数将会被重新随

机(平均值,标准差,取值类型)。

(3)tf.random_uniform:平均分布(最小、最大取值,取值类型)

(4)tf.random_gamma:Gamma分布(形状参数alpha,尺度参数beta,取值类型)

 

12. TensorFlow常数生成函数

解析:

(1)tf.zeros:产生全0的数组。

(2)tf.ones:产生全1的数组。

(3)tf.fill:产生一个全部为给定数字的数组。

(4)tf.constant:产生一个给定值的常量。

 

13. 交叉熵损失函数

解析:给定两个概率分布,通过来表示的交叉熵,如下所示:

交叉熵表示两个概率分布之间的距离。

 

14. tf.initialize_all_variables()和tf.global_variables_initializer()

解析:用tf.global_variables_initializer()代替tf.initialize_all_variables()。

 

15. TensorFlow中维护的集合列表

解析:

(1)tf.GraphKeys.VARIABLES:所有变量(持久化TensorFlow模型)。

(2)tf.GraphKeys.TRAINABLE_VARIABLES:可学习的变量(模型训练,生成模型可视化内容)。

(3)tf.GraphKeys.SUMMARIES:日志生成相关的张量(TensorFlow计算可视化)。

(4)tf.GraphKeys.QUEUE_RUNNERS:处理输入的QueueRunner(输入处理)。

(5)tf.GraphKeys.MOVING_AVERAGE_VARIABLES:所有计算了滑动平均值的变量(计算变量的滑动平均值)。

 

16. TensorFlow中的变量初始化函数

解析:

(1)tf.constant_initializer:将变量初始化为给定常量(常量的取值)。

(2)tf.random_normal_initializer:将变量初始化为满足正态分布的随机值(正态分布的均值和标准差)。

(3)tf.truncated_normal_initializer:将变量初始化为满足正态分布的随机值,但如果随机出来的值偏离平均值超过2

个标准差,那么这个数将会被重新随机(整台分布的均值和标准差)。

(4)tf.random_uniform_initializer:将变量初始化为满足平均分布的随机值(最大,最小值)。

(5)tf.uniform_unit_scaling_initializer:将变量初始化为满足平均分布但不影响输出数量级的随机值(factor即产生

随机值时乘以的系数)

(6)tf.zeros_initializer:将变量设置为全0(变量维度)。

(7)tf.ones_initializer:将变量设置为全1(变量维度)。

 

17. TensorFlow-Slim [9]

解析:TF-Slim is a lightweight library for defining, training and evaluating complex models in TensorFlow. 

Components of tf-slim can be freely mixed with native tensorflow, as well as other frameworks, such as 

tf.contrib.learn.

 

18. TFRecord

解析:将图像数据和标签放在一起的二进制文件,能更好的利用内存,在TensorFlow中快速的复制,移动,读取,存

储等。类似于Caffe中的leveldb和lmdb文件。

 

19. Kubernetes(Google)

解析:Kubernetes is an open-source system for automating deployment, scaling, and management of  containerized applications.

 

20. TensorBoard

解析:

(1)了解TensorFlow计算图的结构及每个TensorFlow计算节点在运行时的时间、内存消耗。

(2)可视化神经网络模型训练过程中各种指标的变化趋势,直观了解神经网络的训练情况。

 

21. step=tf.Variable(0, trainable=False)

解析:trainable: If True, the default, also adds the variable to the graph collection 

GraphKeys.TRAINABLE_VARIABLES. This collection is used as the default list of variables to use by the Optimizer classes.

 

22. tf.train.ExponentialMovingAverage(滑动平均模型)

解析:__init__(decay, num_updates=None, zero_debias=False, name='ExponentialMovingAverage')

(1)decay: Float. The decay to use.

(2)num_updates: Optional count of number of updates applied to variables.

(3)zero_debias: If True, zero debias moving-averages that are initialized with tensors.

(4)name: String. Optional prefix name to use for the name of ops added in apply().

 

23. tf.Session()和tf.InteractiveSession()

解析:

(1)with tf.Session() as sess: ...。 

(2)tf.InteractiveSession():sess=tf.InteractiveSession(); ...; sess.close()。    

 

24. TensorFlow优化器

解析:

(1)tf.train.Optimizer(基类) 

(2)tf.train.GradientDescentOptimizer 

(3)tf.train.AdagradOptimizer 

(4)tf.train.AdagradDAOptimizer 

(5)tf.train.MomentumOptimizer 

(6)tf.train.AdamOptimizer 

(7)tf.train.FtrlOptimizer 

(8)tf.train.RMSPropOptimizer

 

25. tf.train.exponential_decay(learning_rate, global_step, decay_steps, decay_rate, staircase=False, name=None)

解析:

(1)learning_rate: A scalar float32 or float64 Tensor or a Python number. The initial learning rate.

(2)global_step: A scalar int32 or int64 Tensor or a Python number. Global step to use for the decay computation. Must not be negative.

(3)decay_steps: A scalar int32 or int64 Tensor or a Python number. Must be positive. See the decay 

computation above.

(4)decay_rate: A scalar float32 or float64 Tensor or a Python number. The decay rate.

(5)staircase: Boolean. It True decay the learning rate at discrete intervals.

(6)name: string. Optional name of the operation. Defaults to 'ExponentialDecay'

说明:decayed_learning_rate = learning_rate * decay_rate ^ (global_step / decay_steps)

 

参考文献:

[1] Docker中文社区:http://www.docker.org.cn/index.html

[2] Win10 Docker安装使用:http://blog.csdn.net/shi1451042748/article/details/52996046

[3] Win10 TensorFlow(gpu)安装详解:http://blog.csdn.net/sb19931201/article/details/53648615

[4] 开发人员SWIG快速入门:https://www.ibm.com/developerworks/cn/aix/library/au-swig/ 

[5] Welcome to SWIG:http://www.swig.org/

[6] Build and test software of any size, quickly and reliably:https://bazel.build/

[7] ptmalloc,tcmalloc和jemalloc内存分配策略研究:

https://www.owent.net/2013/07/ptmalloctcmalloc%E5%92%8Cjemalloc%E5%86%85%E5%AD%98%E5%88%86%

E9%85%8D%E7%AD%96%E7%95%A5%E7%A0%94%E7%A9%B6.html

[8] Install GPU TensorFlow From Sources:https://alliseesolutions.wordpress.com/2016/09/08/install-gpu-

tensorflow-from-sources-w-ubuntu-16-04-and-cuda-8-0/

[9] TensorFlow-Slim:https://github.com/tensorflow/tensorflow/tree/master/tensorflow/contrib/slim

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

NLP工程化

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值