

本文為英文版的機器翻譯版本，如內容有任何歧義或不一致之處，概以英文版為準。

# 使用 TensorFlow 搭配 Amazon SageMaker AI 的資源
<a name="tf"></a>

您可以使用 Amazon SageMaker AI，以使用自訂 TensorFlow 程式碼來訓練和部署模型。SageMaker AI Python SDK TensorFlow 估算器和模型，以及 SageMaker AI 開放原始碼 TensorFlow 容器可以提供協助。使用下列資源清單，根據您正在使用的 TensorFlow 版本和您要執行的動作來尋找詳細資訊。

## TensorFlow 1.11 版和更新版本
<a name="tf-script-mode"></a>

對於 TensorFlow 版本 1.11 和更新版本，[Amazon SageMaker Python SDK ](https://sagemaker.readthedocs.io/en/stable)支援指令碼模式訓練指令碼。

### 您想要做什麼？
<a name="tf-intent"></a>

我想要在 SageMaker AI 中訓練自訂 TensorFlow 模型。  
對於範例 Jupyter 筆記本，請參閱 [TensorFlow script 模式訓練及服務](https://sagemaker-examples.readthedocs.io/en/latest/sagemaker-python-sdk/tensorflow_script_mode_training_and_serving/tensorflow_script_mode_training_and_serving.html)。  
如需文件，請參閱 [使用 TensorFlow 訓練模型](https://sagemaker.readthedocs.io/en/stable/using_tf.html#train-a-model-with-tensorflow)。

我有已在 SageMaker AI 中訓練的 TensorFlow 模型，而且想要將其部署到託管端點。  
如需詳細資訊，請參閱[部屬 TensorFlow Serving 模型](https://sagemaker.readthedocs.io/en/stable/using_tf.html#deploy-tensorflow-serving-models)。

我有已在 SageMaker AI 外訓練的 TensorFlow 模型，而且想要將其部署到 SageMaker AI 端點  
若需詳細資訊，請參閱[直接從模型成品部署](https://sagemaker.readthedocs.io/en/stable/using_tf.html#deploying-directly-from-model-artifacts)。

我想要參閱[ Amazon SageMaker Python SDK](https://sagemaker.readthedocs.io/en/stable) TensorFlow 類別的 API 文件。  
如需詳細資訊，請參閱 [TensorFlow 預估器](https://sagemaker.readthedocs.io/en/stable/sagemaker.tensorflow.html)。

我想要尋找 SageMaker AI TensorFlow 容器儲存庫。  
如需詳細資訊，請參閱[SageMaker TensorFlow 容器 GitHub 儲存庫](https://github.com/aws/sagemaker-tensorflow-container)。

我想要尋找 AWS Deep Learning Containers 支援之 TensorFlow 版本的相關資訊。  
有關詳細資訊，請參閱[可用的深度學習容器映像](https://github.com/aws/deep-learning-containers/blob/master/available_images.md)。

 如需撰寫 TensorFlow 指令碼模式訓練指令碼，以及使用 TensorFlow 指令碼模式估算器和模型搭配 SageMaker AI 的一般相關資訊，請參閱[使用 TensorFlow 搭配 SageMaker Python SDK](https://sagemaker.readthedocs.io/en/stable/using_tf.html)。

## 適用於 1.11 版和更舊版本的 TensorFlow 傳統模式
<a name="tf-legacy-mode"></a>

[Amazon SageMaker Python SDK ](https://sagemaker.readthedocs.io/en/stable)提供一種支援 TensorFlow 1.11 版和更舊版本的傳統模式。如果符合下列條件，請使用傳統模式 TensorFlow 訓練指令碼，在 SageMaker AI 中執行 TensorFlow 任務：
+ 您有現有的傳統模式指令碼，且您不想轉換為指令碼模式。
+ 您想要使用早於 1.11 的 TensorFlow 版本。

如需撰寫舊版模式 TensorFlow 指令碼以搭配 SageMaker AI Python SDK 使用的相關資訊，請參閱 [TensorFlow SageMaker 估算器和模型](https://github.com/aws/sagemaker-python-sdk/tree/v1.12.0/src/sagemaker/tensorflow#tensorflow-sagemaker-estimators-and-models)。