1,关于TensorFlow
TensorFlow 随着AlphaGo的胜利也火了起来。
google又一次成为大家膜拜的大神了。google大神在引导这机器学习的方向。
同时docker 也是一个非常好的工具,大大的方便了开发环境的构建,之前需要配置安装。
看各种文档,现在只要一个 pull 一个 run 就可以把环境弄好了。
同时如果有写地方需要个性化定制,直接在docker的镜像上面再加一层补丁就好了。
自己的需求就能满足了,同时还可以将这个通用的方法分享出去。
2,下载TensorFlow images
使用hub.docker.com的镜像
docker pull tensorflow/tensorflow:latest
- 1
使用daocloud 的镜像,在国内用速度还是挺快的,如果docker.io的镜像慢,可以用daocloud的。
这个速度非常的快。一样用的。版本也挺新的。
docker pull daocloud.io/daocloud/tensorflow:latest
- 1
3,启动镜像
启动命令,设置端口,同时配置volume 数据卷,用于永久保存数据。加上 –rm 在停止的时候删除镜像。
sudo mkdir -p /data/tensorflow/notebooks
docker run -it --rm --name myts -v /data/tensorflow/notebooks:/notebooks -p 8888:8888 daocloud.io/daocloud/tensorflow:latest
- 1
- 2
启动的时候并不是daemon 模式的,而是前台模式,同时显示了运行的日志。
W 06:48:13.425 NotebookApp] WARNING: The notebook server is listening on all IP addresses and not using encryption. This is not recommended.
[I 06:48:13.432 NotebookApp] Serving notebooks from local directory: /notebooks
[I 06:48:13.432 NotebookApp] 0 active kernels
[I 06:48:13.432 NotebookApp] The Jupyter Notebook is running at: http://[all ip addresses on your system]:8888/?token=2031705799dc7a5d58bc51b1f406d8771f0fdf3086b95642
[I 06:48:13.433 NotebookApp] Use Control-C to stop this server and shut down all kernels (twice to skip confirmation).
[C 06:48:13.433 NotebookApp]
Copy/paste this URL into your browser when you connect for the first time,
to login with a token:
http://localhost:8888/?token=2031705799dc7a5d58bc51b1f406d8771f0fdf3086b95642
- 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9
- 10
打开浏览器就可以直接看到界面了。
同时可以编辑内容:
写第一个 hello world:
import tensorflow as tf
a = tf.constant(10)
b = tf.constant(32)
with tf.Session():
c = tf.add(a,b)
print(c)
print(c.eval())
- 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
其他的使用参考中文手册:
https://github.com/jikexueyuanwiki/tensorflow-zh
里面有pdf 可以下载使用。
还有一个超级炫酷吊炸天的playground :
http://playground.tensorflow.org/
原来博文:https://blog.csdn.net/freewebsys/article/details/70237003