Customizing a PyTorch operation
Implement a custom operation in PyTorch that uses Metal kernels to improve performance.
Overview
Configure the sample code project
Before you run the sample code project:
Follow the instructions in Accelerated PyTorch training on Mac.
Install PyTorch nightly (Python 3.7 or later is required).
pip3 install --pre torch --index-url https://download.pytorch.org/whl/nightly/cpuInstall Ninja
pip3 install NinjaRun the sample.
python3 run_sample.py