DirectML/Python
..
gpgmm@36b2e5ad28
pybind11@882cb76913
samples
src
CMakeLists.txt
README.md
setup.cfg
setup.py

README.md

Python Binding for DirectML Samples

PyDirectML is an open source Python binding library for DirectML written to facilitate DirectML sample authoring in Python. It provides the following capabilities to Python sample authors:

  • Simplified DirectML graph authoring and compilation with operator composition
  • Wrapper of DirectML device and resource management
  • Binding support through NumPy arrays

Build and Installation

Prerequisite: requests

python setup.py install

Usage

In a Python file, import PyDirectML

import pydirectml

Samples

DirectML Python sample code is available under the samples folder. These samples require PyDirectML, which can be built and installed to a Python executing environment.

Debugging

One of the most effective ways to debug Python files is through Visual Studio Code with Visual Studio Code Python extension. Follow this instruction for more details on how to debug Python code in Visual Studio Code.

If mixed-mode debugging across the Python code and the Python binding C++ code becomes necessary, Visual Studio 2019 with Python provides an excellent support in a single package. You may also want to enable debug information for the Python binding C++ code by editing the setup.cfg file and rebuild as follow.

[build_ext]
debug=1