Skip to content

Support the Android NDK with libtorch #14258

Closed
@Suhail

Description

@Suhail

🚀 Feature

Hey folks, I think the best path forward if you want to truly support mobile production environments is to make it easier to allow people to compile libtorch such that it can be used with Android Studio's NDK.

Right now, given the current state of things, I'm forced to fall back on the protobuf, caffe2 solution. I do understand that things are still unstable & a work in progress.

Motivation

Current shared/static libs offered in the docs are pre-built for specific architectures & thereby do not allow you to utilize libtorch on a robust set of production devices easily in the real-world.

For example, in my case, I can't run libtorch even a rooted Android phone because the architecture (aarch64) still has differences in compilation due to the OS/ABI I suspect. The NDK has invested in solving this for developers already via a fairly robust toolchain. It's not obvious how to build pytorch via it & then utilize those various static/shared libs to compile with the NDK.

Additionally, it's not simple to just compile libtorch on an arm64 machine and run the binary on the phone.

Pitch

NDK support will dramatically reduce the numerous pipeline of tools required for a mobile production environment.

This will also help people who do not have the priviledge of developing on a rooted phone & enable fast, client-side inference.

Alternatives

pytorch -> export to onnx -> caffe2 -> Write C++ w/ NDK -> Java

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions