fedora 26中安装tensorboard-1.3.0,以及可视化工具tensorboard的使用

  1. 说明

         本文说明了在Linux操作系统上,以Fedora系统为例,安装Tensorlow环境的步骤。

20179月,TensorFlow已经开放到1.3.0版本,支持多种操作系统。接下来我们就用1.3.0版本来介绍TensorFlow的环境准备过程。


  1. 安装virtualenv

virtualenvPython的沙箱工具,用于创建独立的Python环境。为了不来回修改各种环境变量,这里用virtualenvTensorFlow创建一套“隔离”的Python环境。

首先,在root用户下用pip安装virtualenv

#pip install virtualenv –-upgrade

:如果是非root用户,需要加参数--user


安装好后创建一个工作目录,这里直接在home目录下创建了一个tensorflow文件夹:

#virtualenv --system-site-packages /home/tensorflow

然后进入该目录,激活沙箱:

#cd /home/tensorflow/

#source bin/activate

(tensorflow)#

最后,在virtualenv里安装TensorFlow:

(tensorflow)# pip --default-timeout=100 install -U tensorflow

默认安装所需要的依赖,直至安装完成。


  1. 运行TensorFlow

测试一个简单的例子:

(tensorflow) # python

[GCC 7.1.120170622 (Red Hat 7.1.1-3)] on linux2

Type "help","copyright", "credits" or "license" formore information.

>>>importtensorflow as tf

>>>hello = tf.constant('Hello,TensorFlow!')

>>>sess = tf.Session()

2017-09-1914:43:17.486410: W tensorflow/core/platform/cpu_feature_guard.cc:45]The TensorFlow library wasn't compiled to use SSE4.1 instructions,but these are available on your machine and could speed up CPUcomputations.

2017-09-1914:43:17.486458: W tensorflow/core/platform/cpu_feature_guard.cc:45]The TensorFlow library wasn't compiled to use SSE4.2 instructions,but these are available on your machine and could speed up CPUcomputations.

2017-09-1914:43:17.486473: W tensorflow/core/platform/cpu_feature_guard.cc:45]The TensorFlow library wasn't compiled to use AVX instructions, butthese are available on your machine and could speed up CPUcomputations.

>>>print sess.run(hello)

Hello,TensorFlow!

>>>

TensorFlow环境已经安装成功了。

:每次运行TensorFlow程序时,都需要进入tensorflow目录,然后执行source/bin/activate命令来激活沙箱。


     4.TensorBoard

        TensorBoardTensorFlow自带的一个强大的可视化工具,也是一个Web应用程序套件。接下来通过一个示例来查看

首先,在GitHub代码仓库中将1.3.0版本的TensorFlow源代码下载下来。

下载地址:https://github.com/tensorflow/tensorflow/tree/v1.3.0

Tags中选择1.3.0(最新版本)将跳转到1.3.0版本的代码仓库,下载解压之后即获得源代码。

        这里,我们运行手写数字识别的入门例子。如下:

      (tensorflow)#pythontensorflow-1.3.0/tensorflow/examples/tutorials/mnist/mnist_with_summaries.py

        等程序跑完后,用以下命令打开TensorBoard面板:

     (tensorflow)#tensorboard –logdir=/tmp/tensorflow/mnist/logs/mnist_with_summaries

     TensorBoard0.1.6 at http://localhost:6006 (Press CTRL+C to quit)

     然后我们就可以在浏览器中打开http://localhost:6006,就可以看到TensorBoard面板了。

  • 1
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

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

余额充值