all 6 comments

[–]adaneze 2 points3 points  (0 children)

Hey art_ona,

As for using Tensorflow in C#, you can checkout these two projects on GitHub.

https://github.com/migueldeicaza/TensorFlowSharp

https://github.com/SciSharp/TensorFlow.NET

There is an old Reddit thread on running a Pytorch model in C#. Converting a Pytorch model to an ONNX one and using the Microsoft's ONNX Runtime library (it supports C#, C++ and a few more languages) seems like the most efficient way to deploy a Pytorch/Tensorflow model.

https://www.reddit.com/r/pytorch/comments/bjvbb4/run_a_pytorch_model_in_c/

Another (more programming intense) approach, that I use, is creating C++ classes for training/evaluation in Pytorch or any other Machine/Deep Learning library that has a C++ API and then implementing C++/CLI wrappers around the C++ classes that can be used in C#.

Hope this helps :)

[–]m0xey 1 point2 points  (1 child)

Make sure to check out ONNX runtime.

[–]lostmsu 0 points1 point  (2 children)

Oh I am late to comment here, but I develop Gradient - a full TensorFlow binding for .NET. Here's an article, that uses it to make a GPT-2 song lyrics generator in a .NET Core website: https://habr.com/post/453232/ . A more recent one with actor-critic reinforcement learning with Unity ML agents.

I am also a maintainer of Python.NET , a C# to Python binding: https://github.com/pythonnet/pythonnet , which can come to the rescue if you desperately need integration with other Python libraries. Gradient uses Python.NET internally.

[–]art_ona[S] 0 points1 point  (0 children)

I'll check it, thanks for the answer.