TorchSharp is a .NET library that provides access to the library that powers PyTorch. It is a work in progress, but already provides a .NET API that can be used to perform (1) various operations on ATen Tensors; (2) scoring of TorchScript models; (3) Training of simple neural networks.
Our current focus is to bind the entire API surfaced by libtorch.
Things that you can try:
using AtenSharp;var x = new FloatTensor (100); // 1D-tensor with 100 elementsFloatTensor result = new FloatTensor (100);FloatTensor.Add (x, 23, result);Console.WriteLine (x [12]);
Discussions
We have a chat room on Gitter
Building
Windows
Requirements:
Visual Studio
git
cmake (tested with 3.14)
Commands:
Building: build.cmd
Building from Visual Studio: first build using the command line
Building from Visual Studio: first build using the command line
See all configurations: ./build.sh -?
Run tests from command line: ./build.sh -runtests
Build packages: ./build.sh -buildpackages
Updating package version for new release
To change the package version update this file. Everything is currently considered in preview.
Use the following two MSBuild arguments in order to control the -preview and the build numbers in the name of the nuget packages produced (use one of the two generally):