

# Resources for using PyTorch with Amazon SageMaker AI
<a name="pytorch"></a>

You can use Amazon SageMaker AI to train and deploy a model using custom PyTorch code. The SageMaker AI Python SDK PyTorch estimators and models and the SageMaker AI open-source PyTorch container make writing a PyTorch script and running it in SageMaker AI easier. The following section provides reference material you can use to learn how to use PyTorch with SageMaker AI.

## What do you want to do?
<a name="pytorch-intent"></a>

I want to train a custom PyTorch model in SageMaker AI.  
For a sample Jupyter notebook, see the [PyTorch example notebook](https://github.com/awslabs/amazon-sagemaker-examples/tree/master/sagemaker-python-sdk/pytorch_mnist) in the Amazon SageMaker AI Examples GitHub repository.  
For documentation, see [Train a Model with PyTorch](https://sagemaker.readthedocs.io/en/stable/using_pytorch.html#train-a-model-with-pytorch).

I have a PyTorch model that I trained in SageMaker AI, and I want to deploy it to a hosted endpoint.  
For more information, see [Deploy PyTorch models](https://sagemaker.readthedocs.io/en/stable/using_pytorch.html#deploy-pytorch-models).

I have a PyTorch model that I trained outside of SageMaker AI, and I want to deploy it to a SageMaker AI endpoint  
For more information, see [Deploy your own PyTorch model](https://sagemaker.readthedocs.io/en/stable/frameworks/pytorch/using_pytorch.html#bring-your-own-model).

I want to see the API documentation for [Amazon SageMaker Python SDK](https://sagemaker.readthedocs.io/en/stable) PyTorch classes.  
For more information, see [PyTorch Classes](https://sagemaker.readthedocs.io/en/stable/sagemaker.pytorch.html).

I want to find the SageMaker AI PyTorch container repository.  
For more information, see [SageMaker AI PyTorch Container GitHub repository](https://github.com/aws/deep-learning-containers/tree/master/pytorch).

I want to find information about PyTorch versions supported by AWS Deep Learning Containers.  
For more information, see [Available Deep Learning Container Images](https://github.com/aws/deep-learning-containers/blob/master/available_images.md).

 For general information about writing PyTorch training scripts and using PyTorch estimators and models with SageMaker AI, see [Using PyTorch with the SageMaker Python SDK](https://sagemaker.readthedocs.io/en/stable/using_pytorch.html).