Registry / ai-ml / onnxruntime-directml

onnxruntime-directml

JSON →
library1.24.4pypypiunverified

ONNX Runtime with DirectML execution provider for hardware-accelerated ML inference on Windows devices with DirectX 12 compatible GPUs. Version 1.24.4 requires Python >=3.11 and is maintained by Microsoft. Release cadence follows ONNX Runtime releases.

pip install onnxruntime-directml
INSTALL
IMPORT
SIG · ONNXRUNTIME-DIRECT
O
onnxruntime-directml
ai-mlpythonv1.24.4
Install
Import
Disk
Pass rate
0/ 10
Env Coverage0 / 10
glibc
3.93.13
musl
3.93.13
Install & Compatibility
Where this runs
tested against v? · pip install
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
musl
py 3.103.95 runs
build_error
glibc
py 3.103.95 runs
build_error
Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

InferenceSession
from onnxruntime import InferenceSession
from onnxruntime_directml import InferenceSession
Onnxruntime-directml does not expose its own InferenceSession; it uses the standard onnxruntime session. DirectML is enabled via session options.
SessionOptions
from onnxruntime import SessionOptions
import onnxruntime_directml
SessionOptions is in the onnxruntime package, not a separate directml package.

Basic inference using DirectML provider. Ensure model.onnx exists and is compatible.

import onnxruntime from onnxruntime import InferenceSession, SessionOptions # Enable DirectML execution provider options = SessionOptions() options.enable_training = False providers = ['DmlExecutionProvider', 'CPUExecutionProvider'] session = InferenceSession('model.onnx', options, providers=providers) # Run inference import numpy as np input_name = session.get_inputs()[0].name result = session.run(None, {input_name: np.random.randn(1, 3, 224, 224).astype(np.float32)})
Debug
Known issues
breakingPython 3.11 minimum required as of version 1.24.x. Older Python versions are unsupported.
fix
Upgrade Python to 3.11 or later, or use an older onnxruntime-directml version (but note older versions may lack features).
affects: >=1.24.0
gotchaDirectML execution provider requires Windows 10/11 with DirectX 12 GPU. It will not work on Linux or macOS. Trying to use DmlExecutionProvider on unsupported OS raises an error.
fix
Check platform before using DirectML: import sys; if not sys.platform.startswith('win'): raise RuntimeError('DirectML requires Windows').
affects: all
deprecatedUsing Oracle JDK is deprecated; only Liberica JDK is fully supported. The default JDK download in some documentation points to Oracle, which may cause compatibility issues.
fix
Use Liberica JDK 8 or 11 as the Java runtime for QuickSight.
affects: all
gotchaManually specifying the execution provider order can cause performance degradation if CPU provider is placed before DirectML. Setting providers list correctly is essential.
fix
Always place DirectML provider first: providers=['DmlExecutionProvider', 'CPUExecutionProvider'].
affects: all
Upgrade
Version history
1.24.4latest on PyPI · released Mar 17, 2026
Audit
Dependencies
numpyrequiredRequired for tensor operations in ONNX Runtime.
protobufrequiredUsed for serializing ONNX models.
sympyoptionalRequired for shape inference in some operators.
Agent activity
2 hits · last 30 days
node
2
Resources
onnxruntime-directml — pip install onnxruntime-directml · libregistry