torch-directml
A DirectML backend for hardware acceleration in PyTorch.
Decision gist · record as of 2026-08-14
Yes, if you are on Windows or WSL with a DirectX 12-capable GPU and need PyTorch acceleration without CUDA. The package is actively maintained, has no known vulnerabilities, carries a permissive MIT license, and is backed by Microsoft. However, operator coverage is still developing—verify that your specific PyTorch operations are supported via the operator roadmap before committing to production use.AI-flagged interpretation of the facts on this page — verify before relying
Before you install
- Requires DirectX 12-compatible GPU hardware and Windows or Windows Subsystem for Linux; torch and torchvision must be installed first.
- Medium install friction due to platform-specific wheels (Windows and Linux only) and requirement for torch and torchvision as runtime dependencies.
- Package is actively maintained with recent commits and no known vulnerabilities.
License · maintenance · safety
MIT (permissive) — MIT license permits commercial and private use with minimal restrictions; you may use, modify, and distribute the package freely provided you include the license notice.
last release 2024-09-15 (698 days) · last repo commit 2026-04-27 · 2,579 stars
0 known vulnerabilities (OSV.dev, 2026-08-14) · 88,718 downloads/mo, #13,709 on PyPI
Alternatives
Verify before relying
pip install torch-directml
import torch
device = torch.device('dml')
tensor = torch.randn(10, 10, device=device)- Completeness of operator coverage—the fact sheet notes active development and an operator roadmap but does not specify how many core PyTorch operations are currently supported.
- Performance characteristics compared to native CUDA or other backends on specific hardware.
- Data collection scope and opt-out mechanisms for GPU device info and CPU fallback operators mentioned in the privacy notice.
What it is and what it does
torch-directml is a PyTorch backend plugin that routes computation to DirectML, a hardware-accelerated DirectX 12 library maintained by Microsoft. It allows PyTorch models to train and run inference on a broad range of GPUs—AMD, Intel, NVIDIA, and Qualcomm—without requiring CUDA or vendor-specific drivers, making it particularly useful on Windows and Windows Subsystem for Linux systems where CUDA may not be available or practical.
The package is in active development (classified as Alpha) and depends on torch and torchvision. It provides pre-built wheels for Python 3.7 through 3.12 on both Windows and Linux, though operator coverage is still expanding. The project collects GPU device info and CPU fallback data to improve operator support, and it is maintained by Microsoft with an open issue tracker and active community feedback channels.
Use it for
- Train PyTorch models on Windows machines with AMD or Intel GPUs where CUDA is unavailable.
- Run inference on DirectX 12-capable hardware without installing vendor-specific GPU drivers.
- Prototype machine learning on consumer-grade GPUs (AMD, Intel, Qualcomm) before deploying to NVIDIA infrastructure.
- Accelerate PyTorch workloads in Windows Subsystem for Linux environments with GPU support.
- Evaluate multi-vendor GPU compatibility for a PyTorch application without rewriting code.
Worth the install?
AI-flagged interpretation of the facts on this page. Verify before relying on it.
Yes, if you are on Windows or WSL with a DirectX 12-capable GPU and need PyTorch acceleration without CUDA.
The package is actively maintained, has no known vulnerabilities, carries a permissive MIT license, and is backed by Microsoft. However, operator coverage is still developing—verify that your specific PyTorch operations are supported via the operator roadmap before committing to production use.
Install
torch-directml on PyPI
Before you install
Medium install friction due to platform-specific wheels (Windows and Linux only) and requirement for torch and torchvision as runtime dependencies. Package is actively maintained with recent commits and no known vulnerabilities.
Requires DirectX 12-compatible GPU hardware and Windows or Windows Subsystem for Linux; torch and torchvision must be installed first.
License in practice
MIT license permits commercial and private use with minimal restrictions; you may use, modify, and distribute the package freely provided you include the license notice.
Quickstart
pip install torch-directml
import torch
device = torch.device('dml')
tensor = torch.randn(10, 10, device=device)
Verify before relying
- Completeness of operator coverage—the fact sheet notes active development and an operator roadmap but does not specify how many core PyTorch operations are currently supported.
- Performance characteristics compared to native CUDA or other backends on specific hardware.
- Data collection scope and opt-out mechanisms for GPU device info and CPU fallback operators mentioned in the privacy notice.
Package facts
| License | MIT permissive |
| Python support | Supports the current Python release >=3.7 |
| Install friction | Medium. Platform-specific wheel |
| Runtime dependencies | 2 packagestorchtorchvision |
| Maintenance | Actively maintained 698 days since the last release |
| Last repo commit | |
| First released | |
| Downloads | 88,718 / month, #13,709 on PyPI 30-day window, as of 2026-08-14 |
| Known vulnerabilities | None known OSV.dev, checked 2026-08-14 |
| Classifiers | Development Status :: 3 - AlphaIntended Audience :: DevelopersIntended Audience :: EducationIntended Audience :: Science/ResearchLicense :: OSI Approved :: MIT LicenseProgramming Language :: C++Programming Language :: Python :: 3Programming Language :: Python :: 3.10Programming Language :: Python :: 3.7Programming Language :: Python :: 3.8Programming Language :: Python :: 3.9Topic :: Scientific/EngineeringTopic :: Scientific/Engineering :: Artificial IntelligenceTopic :: Scientific/Engineering :: MathematicsTopic :: Software DevelopmentTopic :: Software Development :: LibrariesTopic :: Software Development :: Libraries :: Python Modules |
Evidence: torch_directml-0.2.5.dev240914-cp310-cp310-manylinux2010_x86_64.whl; torch_directml-0.2.5.dev240914-cp310-cp310-win_amd64.whl; torch_directml-0.2.5.dev240914-cp311-cp311-manylinux2010_x86_64.whl; torch_directml-0.2.5.dev240914-cp311-cp311-win_amd64.whl; torch_directml-0.2.5.dev240914-cp312-cp312-manylinux2010_x86_64.whl; torch_directml-0.2.5.dev240914-cp312-cp312-win_amd64.whl; torch_directml-0.2.5.dev240914-cp38-cp38-manylinux2010_x86_64.whl; torch_directml-0.2.5.dev240914-cp38-cp38-win_amd64.whl; torch_directml-0.2.5.dev240914-cp39-cp39-manylinux2010_x86_64.whl; torch_directml-0.2.5.dev240914-cp39-cp39-win_amd64.whl
Tags
Let your AI agent find packages like this
Example. Real query, live index.
You found this page by searching. An agent finds it by wishing: SkillFed indexes 14,416 PyPI packages by what they can do, searchable in plain language.
wish › “pytorch gpu acceleration directml”
- torch-directmlEnables PyTorch to use DirectML for GPU acceleration on DirectX…
- torchlibrosaProvides PyTorch implementations of librosa audio feature extraction…
- ipex-llmAccelerates large language model inference on Intel hardware (GPU,…
Give your agent the search over MCP, or paste the wish link into any chat.
More Software Development packages
Provides backported and experimental type hints for Python 3.9+, allowing use of newer typing features on older Python versions and enabling early experimentation with type system PEPs before they enter the standard library.
NumPy provides an N-dimensional array object and a comprehensive suite of mathematical, linear algebra, Fourier transform, and random number functions for scientific computing in Python.
FastAPI is a Python web framework for building REST APIs using type hints, with automatic request validation, serialization, and interactive API documentation.
Provides a way to document function parameters, class attributes, return types, and variables inline using Python's `Annotated` type hint syntax instead of traditional docstrings.
Typer builds command-line applications from Python functions using type hints, automatically generating help text, argument parsing, and shell completion.
Install it if you are building CLIs in Python.
Distlib provides low-level packaging utilities for building, distributing, and managing Python software—including metadata handling, version specifiers, wheel support, script installation, and dependency resolution.
See also torch · nvidia-cudnn-cu11 · transformer-engine-cu12 · transformer-engine-cu13 · nvidia-cudnn-cu12 · transformer-engine · nvidia-cuda-runtime-cu12 · torchtitan · nvidia-cudnn-cu13 · nvidia-cuda-runtime-cu11