PyTorch is the go-to framework for deep learning, and on AMD hardware it runs through ROCm. Once ROCm is installed, getting PyTorch working on a Radeon GPU is just a pip install away.

I tested this on a Radeon RX 6800M (gfx1031, RDNA2) with ROCm 7.14 on Ubuntu 26.04 — the exact commands below are what worked. The same flow applies to other RDNA2/RDNA3 cards; just swap the gfx target in the install command.

Prerequisites

Step 1 — Create a virtual environment

Always install PyTorch in a fresh virtual environment so it never conflicts with system packages or other Python projects:

python3.12 -m venv .venv

Use whichever Python version you have — python3.11, python3.13, or python3.14 all work. This creates a folder called .venv in your current directory.

Step 2 — Activate the environment

Activate it so python and pip point at the venv:

source .venv/bin/activate

You'll know it worked when the prompt shows (.venv) at the start.

Step 3 — Install PyTorch with ROCm support

Install the ROCm-enabled PyTorch, torchvision, and torchaudio from AMD's wheel repository. Use your GPU's device-gfx target — for the RX 6800M that's device-gfx1031:

python -m pip install --index-url https://repo.amd.com/rocm/whl-multi-arch/ \
    "torch[device-gfx1031]==2.12.0+rocm7.14.0" \
    "torchvision[device-gfx1031]==0.27.0+rocm7.14.0" \
    "torchaudio==2.11.0+rocm7.14.0"

A few notes:

If pip complains about resolving dependencies, make sure the venv is active and you're passing --index-url https://repo.amd.com/rocm/whl-multi-arch/ — that repository is what AMD publishes the ROCm builds to.

Step 4 — Verify the GPU is detected

Run this one-liner to confirm PyTorch sees your AMD GPU:

python -c "import torch; print(torch.cuda.is_available())"

It prints True if PyTorch and ROCm are installed correctly and your AMD GPU is detected. (Yes, it's cuda in the API — PyTorch keeps the same interface for ROCm so code is portable.)

You can go further and check the device name:

python -c "import torch; print(torch.cuda.get_device_name(0))"

On the RX 6800M this reports something like AMD Radeon RX 6800M.

What's next?

With PyTorch running on ROCm you can:

The official guide has more detail if you need it: Install PyTorch for ROCm — AMD AI ecosystem docs.