TorchSharp icon indicating copy to clipboard operation
TorchSharp copied to clipboard

How to use it in maui

Open Barshan-Mandal opened this issue 1 year ago • 8 comments

I want to use torchsharp for android and ios .How can i do it?

Barshan-Mandal avatar Aug 16 '24 08:08 Barshan-Mandal

it might be pretty hard... #1083

yueyinqiu avatar Aug 16 '24 15:08 yueyinqiu

but there must be a way as we know that c# is not capable enough to do much things like torch

Barshan-Mandal avatar Aug 16 '24 18:08 Barshan-Mandal

make an easy and seamless integration.you may use pytorch mobile

Barshan-Mandal avatar Aug 16 '24 18:08 Barshan-Mandal

You're not supposed to put torchlib on user devices, its too massive. You pretty much have two options:

  1. Export your models as ONNX and use that for inference.
  2. Build Asp .net core server application hosting TorchSharp stuff and expose it to android/ios frontend.

asieradzk avatar Aug 19 '24 07:08 asieradzk

You're not supposed to put torchlib on user devices, its too massive. You pretty much have two options:

  1. Export your models as ONNX and use that for inference.
  2. Build Asp .net core server application hosting TorchSharp stuff and expose it to android/ios frontend.

but how does onnx exist for embedded devices?

Barshan-Mandal avatar Aug 19 '24 12:08 Barshan-Mandal

You're not supposed to put torchlib on user devices, its too massive. You pretty much have two options:

  1. Export your models as ONNX and use that for inference.
  2. Build Asp .net core server application hosting TorchSharp stuff and expose it to android/ios frontend.

but how does onnx exist for embedded devices?

Something exists. For instance Unity already made two ONNX inference engines that run on mobile. The recent one is called Sentis, you can maybe use that? https://unity.com/products/sentis

asieradzk avatar Aug 19 '24 13:08 asieradzk

TorchSharp supports the platforms that libtorch supports: the CPU backend on Windows X64, MacOS M1/M2/M3, Linux X64. In addition, both Windows and Linux support then libtorch CUDA backends.

NiklasGustafsson avatar Aug 20 '24 21:08 NiklasGustafsson

Libtorch is supported in both android and ios

Barshan-Mandal avatar Jul 06 '25 03:07 Barshan-Mandal