TensorFlow - 深度学习 AMI
Amazon Web Services 文档中描述的 Amazon Web Services 服务或功能可能因区域而异。要查看适用于中国区域的差异,请参阅 中国的 Amazon Web Services 服务入门 (PDF)

本文属于机器翻译版本。若本译文内容与英语原文存在差异,则一律以英文原文为准。

TensorFlow

正在激活 TensorFlow

本教程介绍如何在运行带有 Conda 的深度学习 AMI(Conda TensorFlow 上的 DLAMI)的实例上激活并运行程序。 TensorFlow

当框架的稳定 Conda 程序包发布时,它会在 DLAMI 上进行测试并预安装。如果您希望运行最新的、未经测试的每日构建版本,您可以手动Install TensorFlow 的夜间构建(实验版)

和 Cond TensorFlow a 一起在 DLAMI 上跑步
  1. 要激活 TensorFlow,请使用 Conda 打开 DLAMI 的亚马逊弹性计算云 (Amazon EC2) 实例。

    • 对于带有 CUDA 9.0 TensorFlow 和 MKL-DNN 的 Python 3 上的 Keras 2,请运行以下命令:

      $ source activate tensorflow_p36
    • 对于带有 CUDA 9.0 TensorFlow 和 MKL-DNN 的 Python 2 上的 Keras 2,请运行以下命令:

      $ source activate tensorflow_p27
  2. 启动 iPython 终端:

    (tensorflow_p36)$ ipython
  3. 运行一个 TensorFlow 程序以验证它是否正常运行:

    import tensorflow as tf hello = tf.constant('Hello, TensorFlow!') sess = tf.Session() print(sess.run(hello))

    Hello, TensorFlow! 应显示在您的屏幕上。

Install TensorFlow 的夜间构建(实验版)

您可以使用 Conda 将最新 TensorFlow 版本安装到深度学习 AMI 上的任一或两个 TensorFlow Conda 环境中。

TensorFlow 从夜间版本中安装
    • 对于 Python 3 TensorFlow 环境,请运行以下命令:

      $ source activate tensorflow_p36
    • 对于 Python 2 TensorFlow 环境,请运行以下命令:

      $ source activate tensorflow_p27
  1. 移除当前安装的 TensorFlow。

    注意

    其余步骤假定您使用的是 tensorflow_p36 环境。

    (tensorflow_p36)$ pip uninstall tensorflow
  2. 安装最新的夜间版本。 TensorFlow

    (tensorflow_p36)$ pip install tf-nightly
  3. 要验证您是否已成功安装最新的夜间版本,请启动 IPython 终端并检查的版本。 TensorFlow

    (tensorflow_p36)$ ipython
    import tensorflow print (tensorflow.__version__)

    输出应类似于以下内容:1.12.0-dev20181012

更多教程

TensorFlow 和 Horovod

TensorBoard

TensorFlow 上菜

有关教程,请参阅 DLAMI 的主目录中名为 Deep Learning AMI with Conda tutorials 的文件夹。

有关更多教程和示例,请参阅 TensorFlow Python API 的 TensorFlow 文档或TensorFlow访问网站。