dneprDroid / pytorch-coreml-custom-layer-example

PyTorch to CoreML: Writing custom layers with Metal shaders (warping / grid sample operation) https://medium.com/@ovechko.056/pytorch-to-coreml-writing-custom-layers-with-metal-e8922b51895

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

pytorch-coreml-custom-layer-example

PyTorch to CoreML: Writing custom layers with Metal

pytorch-demo-image

Convert PyTorch model

cd Convert
python3 -m pip install -r requirements.txt
python3 convert.py -o /path/to/output/resulting/mlmodel/file

Run the demo app

Open TorchCoreMLDemo.xcodeproj in Xcode, build and run the app.

Shader

The code of the grid sample Metal-shader is here.

More information about grid sample (warper) algorithm you can find here.

About

PyTorch to CoreML: Writing custom layers with Metal shaders (warping / grid sample operation) https://medium.com/@ovechko.056/pytorch-to-coreml-writing-custom-layers-with-metal-e8922b51895


Languages

Language:Swift 64.3%Language:Python 25.2%Language:Metal 10.6%