--- id: torch-directml version: "0.2.5.dev240914" license: MIT license_treatment: permissive maintenance: active --- # torch-directml — A DirectML backend for hardware acceleration in PyTorch. License: permissive · Maintenance: active · Downloads: 88.7K/mo ## 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 above — verify before relying. Enables PyTorch to use DirectML for GPU acceleration on DirectX 12-compatible hardware from AMD, Intel, NVIDIA, and Qualcomm. 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 pip install torch-directml uv add torch-directml poetry add torch-directml ## Installing torch-directml 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. 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) Requires DirectX 12-compatible GPU hardware and Windows or Windows Subsystem for Linux; torch and torchvision must be installed first. 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_current - Install friction: medium - Maintenance: active - Downloads: 88.7K/month (top 15,000 on PyPI) - Known vulnerabilities: none known ## Tags pytorch gpu acceleration directml, directx 12 machine learning, pytorch hardware acceleration windows, directml pytorch backend, gpu training inference pytorch, amd intel nvidia gpu pytorch, directx 12 gpu pytorch, gpu-acceleration, directml, pytorch-backend [View on SkillFed](https://skillfed.io/packages/torch-directml) · [View on PyPI](https://pypi.org/project/torch-directml/)