{"id":24721,"library":"torch-directml","title":"PyTorch DirectML","description":"Provides a DirectML backend for hardware acceleration in PyTorch, enabling GPU acceleration on Windows devices with DirectX 12 compatible GPUs (including AMD, Intel, and NVIDIA). Current version is 0.2.5.dev240914, with preview releases following a monthly cadence.","status":"active","version":"0.2.5.dev240914","language":"python","source_language":"en","source_url":"https://github.com/microsoft/DirectML","tags":["pytorch","directml","gpu-acceleration","windows","machine-learning"],"install":[{"cmd":"pip install torch-directml","lang":"bash","label":"Install latest preview"}],"dependencies":[{"reason":"Required; torch-directml is a backend plugin for PyTorch.","package":"torch","optional":false}],"imports":[{"wrong":"import torch_directml","symbol":"torch_directml","correct":"import torch_directml"}],"quickstart":{"code":"import torch\nimport torch_directml\ndevice = torch_directml.device()\ntensor = torch.tensor([1.0, 2.0, 3.0]).to(device)\nprint(tensor.device)","lang":"python","description":"Basic setup: import torch_directml, get the default DirectML device, move a tensor to it."},"warnings":[{"fix":"Use `torch_directml.device()` or `torch_directml.device(torch_directml.device_count() - 1)` for specific devices.","message":"torch-directml does not support CUDA APIs; use torch_directml.device() instead of torch.device('cuda').","severity":"gotcha","affected_versions":"all"},{"fix":"Use `import torch_directml` instead of `import dml`.","message":"The `dml` module alias is deprecated; always import `torch_directml`.","severity":"deprecated","affected_versions":"<=0.2.4"},{"fix":"Run on Windows 10/11 with DirectX 12 capable GPU.","message":"Only Windows is supported; Linux/WSL is not supported for torch-directml (separate package tensorflow-directml may work for TF).","severity":"gotcha","affected_versions":"all"}],"env_vars":null,"search_vec":"'0.2.5':31 '12':20 'acceler':9,14,44 'amd':24 'backend':6 'cadenc':39 'compat':21 'current':28 'dev240914':32 'devic':17 'directml':2,5,41 'directx':19 'enabl':12 'follow':36 'gpu':13,43 'gpu-acceler':42 'gpus':22 'hardwar':8 'includ':23 'intel':25 'learn':48 'machin':47 'machine-learn':46 'month':38 'nvidia':27 'preview':34 'provid':3 'pytorch':1,11,40 'releas':35 'version':29 'window':16,45","created_at":"2026-05-01T08:14:35.017663+00:00","updated_at":"2026-05-01T08:14:35.017663+00:00","problems":{"verify_error":"Traceback (most recent call last):\n  File \"<string>\", line 1, in <module>\n  File \"/tmp/tmp28wpiqfg/venv/lib/python3.12/site-packages/torch_directml/__init__.py\", line 18, in <module>\n    torch.ops.load_library(directml_dll)\n  File \"/tmp/tmp28wpiqfg/venv/lib/python3.12/site-packages/torch/_ops.py\", l"},"ecosystem":"pypi","meta_description":null,"install_score":null,"quickstart_score":null,"quickstart_tag":null,"pypi_latest":"0.2.5.dev240914","cli_name":"","cli_version":null,"type":"library","homepage":null,"github":"https://github.com/microsoft/directml","docs":null,"changelog":null,"pypi":"https://pypi.org/project/torch-directml/","npm":null,"openapi_spec":null,"status_page":null,"smithery":null,"categories":["ai-ml","aws"],"base_url":null,"auth_type":null,"provenance":{"verified_status":"import_fail","verified_at":"2026-07-03","last_verified":"2026-07-03","next_check":"2026-07-10","install_tag":null}}