Swift + PyTorch mashup (Xcode / macOS)

This sample project demonstrates swift / python interoperability with pyTorch.

The swift code (leveraging swift for tensorflow toolchain) - can interoperate with an individual python class.

//swift
let neuralNet = Python.import("NeuralNet").NeuralNet() //  load local NeuralNet.py
// NeuralNet.py 

Small print
N.B. you have to hard code the customClassPath for the app to where you’ve saved files to correctly load the python file.

The project is using 2,7 with miniconda - but it’s now possible to use python 3 in latest toolchain
see -
PythonLibrary.useVersion(2, 7)