May 2020
Intermediate to advanced
530 pages
17h 8m
English
There is no available binary distribution of PyTorch for mobile devices, so we need to build it from source code. We can do this in the same way as we compile its regular version but with additional CMake parameters to enable mobile mode. You also have to install the Android Native Development Kit (NDK), which includes an appropriate version of the C/C++ compiler and the Android native libraries that are required to build the application. The following code snippet shows how to use the command-line environment to check out PyTorch and build its Android mobile version:
cd /home/[USER]git clone https://github.com/pytorch/pytorch.gitcd pytorch/git checkout v1.2.0git submodule update --initexport ANDROID_NDK=/home/[USER]/Android/Sdk/ndk/20.0.5594570 ...
Read now
Unlock full access