

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

# TensorFlow 2
<a name="tutorial-tensorflow-2"></a>

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

当框架的稳定 Conda 程序包发布时，它会在 DLAMI 上进行测试并预安装。

## 正在激活 TensorFlow 2
<a name="tutorial-tensorflow-2-overview"></a>

**和 Cond TensorFlow a 一起在 DLAMI 上跑步**

1. 要激活 TensorFlow 2，请使用 Conda 打开 DLAMI 的亚马逊弹性计算云 (Amazon EC2) 实例。

1. 对于使用 TensorFlow CUDA 10.1 和 MKL-DNN 的 Python 3 上的 2 和 Keras 2，请运行以下命令：

   ```
   $ source activate tensorflow2_p310
   ```

1. 启动 iPython 终端：

   ```
   (tensorflow2_p310)$ ipython
   ```

1. 运行 TensorFlow 2 程序以验证它是否正常运行：

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

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

## 更多教程
<a name="tutorial-tensorflow-2-more"></a>

有关更多教程和示例，请参阅 [TensorFlow Python API](https://www.tensorflow.org/api_docs/python/) 的 TensorFlow 文档或[TensorFlow](https://www.tensorflow.org)访问网站。