On master branch when doing custom build for Android I have got 40% decrease in Lib size (for libpytorch_jni.so). However when doing custom build for iOS with the same .yaml file I have got about 2.7% decrease (for libtorch_cpu.a).
I did custom builds as described here: https://pytorch.org/mobile/home/
@hhov The size reduction happens when you link your static libraries to output the final binary, as linker can strip most of the unused code ( -dead_strip ). Unlike dynamic libraries(.so in Android), linker can’t strip code when compiling static libraries.