MIT License - Apple Developer sample code Downloaded via Cupertino (https://github.com/mihaelamj/cupertino) |
||
|---|---|---|
| .. | ||
| LICENSE | ||
| .gitignore | ||
| compiler.py | ||
| CustomSoftshrink.h | ||
| CustomSoftshrink.mm | ||
| README.md | ||
| run_sample.py | ||
| softshrink.py | ||
Customizing a PyTorch operation
Implement a custom operation in PyTorch that uses Metal kernels to improve performance.
Overview
- Note: This sample code project is associated with WWDC23 session 10050: Optimize machine learning for Metal apps.
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/cpu -
Install Ninja
pip3 install Ninja -
Run the sample.
python3 run_sample.py