Setting PyTorch Environment for GPU#

This page describes the procedure to setup a DirectML-enabled PyTorch environment on Windows for a supported AMD GPU.

Pre-requisites#

GPUs: AMD Radeon™ RX Graphics Cards or AMD Radeon™ PRO Graphics Cards

See Enable PyTorch with DirectML on Windows

Install Python Virtual Environment#

  1. Follow the steps to install Python on Windows

  2. Then continue by creating a Python virtual environment

Once these steps are completed, install Pytorch with DirectML.

Install Pytorch with DirectML#

Inside of the venv run:

python -m pip install torch-directml

Copyright (C) 2025 Advanced Micro Devices, Inc. All rights reserved.

SPDX-License-Identifier: MIT