LibTorch for mobile devices

I want to compile my pytorch c++ Frontend code locally in my x86_64 Ubuntu but using a g++ arm compiler. Using the so file which I get after compilation to use in Android applications. Now, I am unable to use the compiled file as LibTorch file is compiled in x86_64. Is there a way to download LibTorch file for arm processor.

And the only way I can build that is building LibTorch source file from arm server. Is there any other way I can do that

Libtorch cross-compiles well for Android, but not with g++ (Android stopped supporting this).

Best regards


Hi Tom,

But, this means that I have to put the file in my android which would be unnecessary. It takes huge space, {read from the discussion forum}. I want to build a complete so file locally and to place that in the android, rather than writing code in android and building from there.

I am pretty beginner in this, could you please help me to figure out the best way to do that ?

I’d strongly recommend to

  • try out the standard way first,
  • see what android gives you (the installed binary is much smaller than the one you install into the development environment),
  • follow the “dieting” tutorial (removing unneeded ops).

Most likely after these, you already have something that is very reasonable.

Best regards