TensorFlow 从入门到精通

blog.csdn.net/column/details/tf-starter-to-hacker.html

TensorFlow 从入门到精通(一):安装和使用
blog.csdn.net/kkk584520/article/details/51476816
(注意:此处参考我之前创建conda环境,在其中安装tensorflow的教程)

使用过程

假设读者已经按照上述步骤安装了 GPU 版本 TensorFlow 0.12,接下来可以运行经典例程(MNIST):

# python -m tensorflow.models.image.mnist.convolutional(以后就在site-packages下面以这样的方式运行)

结果:

Validation error: 0.8%
Step 8400 (epoch 9.77), 6.9 ms
Minibatch loss: 1.596, learning rate: 0.006302
Minibatch error: 0.0%
Validation error: 0.7%
Step 8500 (epoch 9.89), 7.1 ms
Minibatch loss: 1.603, learning rate: 0.006302
Minibatch error: 0.0%
Validation error: 0.9%
Test error: 0.8%
echo@echo-PC:~/anaconda2/envs/tensorflow/lib/python2.7/site-packages$ python -m tensorflow.models.image.mnist.convolutional

注意:改成 python -m tensorflow/models/image/mnist/convolutional都行(应该是python的问题,linux下“.”不能找到子目录)

TensorFlow 从入门到精通(二):MNIST 例程源码分析blog.csdn.net/kkk584520/article/details/51477537

对应文件为 /usr/lib/python2.7/site-packages/tensorflow/models/image/mnist/convolutional.py

打开例程源码:

注释见tensorflow/models/image/mnist/convolutional.py

optimizer = tf.train.MomentumOptimizer(learning_rate,  0.9).minimize(loss, global_step=batch)#其中0.9的解释:

几乎看完所有代码!!!!

TensorFlow 从入门到精通(三):ImageNet 例程源码分析blog.csdn.net/kkk584520/article/details/51477729

见/home/echo/tensorflow /models/image/imagenet/classify_image.py

先不读了,还是读吧,最后一篇!!!差不多看完,不过这里好像是利用已有的model对某个图像进行测试,run一下:

echo@echo-PC:~/anaconda2/envs/tensorflow/lib/python2.7/site-packages$ python -m tensorflow.models.image.imagenet.classify_image

I tensorflow/stream_executor/dso_loader.cc:108] successfully opened CUDA library libcublas.so locally
I tensorflow/stream_executor/dso_loader.cc:108] successfully opened CUDA library libcudnn.so locally
I tensorflow/stream_executor/dso_loader.cc:108] successfully opened CUDA library libcufft.so locally
I tensorflow/stream_executor/dso_loader.cc:108] successfully opened CUDA library libcuda.so.1 locally
I tensorflow/stream_executor/dso_loader.cc:108] successfully opened CUDA library libcurand.so locally
I tensorflow/stream_executor/cuda/cuda_gpu_executor.cc:925] successful NUMA node read from SysFS had negative value (-1), but there must b
e at least one NUMA node, so returning NUMA node zero
I tensorflow/core/common_runtime/gpu/gpu_init.cc:102] Found device 0 with properties:
name: GeForce GTX TITAN X
major: 5 minor: 2 memoryClockRate (GHz) 1.076
pciBusID 0000:01:00.0
Total memory: 12.00GiB
Free memory: 11.37GiB
I tensorflow/core/common_runtime/gpu/gpu_init.cc:126] DMA: 0
I tensorflow/core/common_runtime/gpu/gpu_init.cc:136] 0:  Y
I tensorflow/core/common_runtime/gpu/gpu_device.cc:839] Creating TensorFlow device (/gpu:0) -> (device: 0, name: GeForce GTX TITAN X, pci
bus id: 0000:01:00.0)
W tensorflow/core/framework/op_def_util.cc:332] Op BatchNormWithGlobalNormalization is deprecated. It will cease to work in GraphDef versi
on 9. Use tf.nn.batch_normalization().
giant panda, panda, panda bear, coon bear, Ailuropoda melanoleuca (score = 0.89233)
indri, indris, Indri indri, Indri brevicaudatus (score = 0.00859)
lesser panda, red panda, panda, bear cat, cat bear, Ailurus fulgens (score = 0.00264)
custard apple (score = 0.00141)
earthstar (score = 0.00107)
echo@echo-PC:~/anaconda2/envs/tensorflow/lib/python2.7/site-packages$

TensorFlow 从入门到精通(七):TensorFlow 运行原理
blog.csdn.net/kkk584520/article/details/51553823

TensorFlow 从入门到精通_第1张图片

在 TensorFlow 有向图中,每个节点表示运算符,可以有零个或多个输入,零个或多个输出。

有关图及张量的实现源码均位于 tensorflow/tensorflow/python/framework/ops.py,我们后面会细讲。

运算符相关的代码位于:tensorflow/tensorflow/python/ops/ 目录下。

3. 会话(Sessions)

客户端程序通过创建会话同 TensorFlow 系统交互。

为了创建一个计算图,会话接口支持扩展方法来补充当前图。

Run 接口允许指定将某个张量 Tensor 作为入口参数馈入计算图,得到一组计算输出。

会话相关源码位于 tensorflow/tensorflow/python/client/session.py,具体我们会在后面细讲。

你可能感兴趣的:(TensorFlow 从入门到精通)