[PyTorch] Enable template build at aten operator level (#53801)
Summary:
Pull Request resolved: https://github.com/pytorch/pytorch/pull/53801
## Summary
Enable partial explicit Aten level sources list for lite interpreter. More aten level source list will be added.
1. Use `gen_selected_mobile_ops_header.py ` to generate `selected_mobile_ops.h`. Currently, it only includes selected operators, and dtypes is all.
2. Add a custom target includes only `seleteted_mobile_ops.h`, and add it to `torch_cpu` dependency, when `BUILD_LITE_INTERPRETER` is enabled.
As a note, the current input yaml file is slightly different than the one use in internal. Will align these two yaml as next step.
**Android**
x86:
`SELECTED_OP_LIST=/Users/chenlai/Documents/pytorch/experiemnt/deeplabv3_scripted.yaml BUILD_LITE_INTERPRETER=1 ./scripts/build_pytorch_android.sh x86`
libpytorch_jni_lite.so -- 3.4 MB
armeabi-v7a
`SELECTED_OP_LIST=/Users/chenlai/Documents/pytorch/experiemnt/deeplabv3_scripted.yaml BUILD_LITE_INTERPRETER=1 ./scripts/build_pytorch_android.sh armeabi-v7a`
libpytorch_jni_lite.so -- 2.5 MB
**iOS:**
```
(base) chenlai@chenlai-mp install % du -sh *
15M include
57M lib
2.8M share
```
```
(base) chenlai@chenlai-mp lib % ls -lh
total 117296
-rw-r--r-- 1 chenlai staff 3.2M Mar 15 22:03 libXNNPACK.a
-rw-r--r-- 1 chenlai staff 913K Mar 15 22:03 libc10.a
-rw-r--r-- 1 chenlai staff 4.6K Mar 15 22:03 libclog.a
-rw-r--r-- 1 chenlai staff 42K Mar 15 22:03 libcpuinfo.a
-rw-r--r-- 1 chenlai staff 1.5M Mar 15 22:03 libeigen_blas.a
-rw-r--r-- 1 chenlai staff 44K Mar 15 22:03 libpthreadpool.a
-rw-r--r-- 1 chenlai staff 166K Mar 15 22:03 libpytorch_qnnpack.a
-rw-r--r-- 1 chenlai staff 384B Mar 15 22:03 libtorch.a
-rw-r--r-- 1 chenlai staff 51M Mar 15 22:03 libtorch_cpu.a
```
### **Master (Baseline):**
**Android**
x86:
`SELECTED_OP_LIST=/Users/chenlai/Documents/pytorch/experiemnt/deeplabv3_scripted.yaml BUILD_LITE_INTERPRETER=1 ./scripts/build_pytorch_android.sh x86`
libpytorch_jni_lite.so -- 3.8 MB
armeabi-v7a
`SELECTED_OP_LIST=/Users/chenlai/Documents/pytorch/experiemnt/deeplabv3_scripted.yaml BUILD_LITE_INTERPRETER=1 ./scripts/build_pytorch_android.sh armeabi-v7a`
libpytorch_jni_lite.so -- 2.8 MB
**iOS:**
```
(base) chenlai@chenlai-mp install % du -sh *
15M include
58M lib
2.8M share
```
```
(base) chenlai@chenlai-mp lib % ls -lh
total 119600
-rw-r--r-- 1 chenlai staff 3.2M Mar 4 23:16 libXNNPACK.a
-rw-r--r-- 1 chenlai staff 910K Mar 4 23:16 libc10.a
-rw-r--r-- 1 chenlai staff 4.6K Mar 4 23:16 libclog.a
-rw-r--r-- 1 chenlai staff 42K Mar 4 23:16 libcpuinfo.a
-rw-r--r-- 1 chenlai staff 1.5M Mar 4 23:16 libeigen_blas.a
-rw-r--r-- 1 chenlai staff 44K Mar 4 23:16 libpthreadpool.a
-rw-r--r-- 1 chenlai staff 166K Mar 4 23:16 libpytorch_qnnpack.a
-rw-r--r-- 1 chenlai staff 384B Mar 4 23:16 libtorch.a
-rw-r--r-- 1 chenlai staff 52M Mar 4 23:16 libtorch_cpu.a
```
Test Plan: Imported from OSS
Reviewed By: dhruvbird
Differential Revision: D27074814
Pulled By: cccclai
fbshipit-source-id: 762b5ad5b87b6a262444392fd089249c4837ba18