前言
在幾年前的文章中曾經介紹過關於如何使用NNAPI來在設備上運行AI模型
在Google在最新的NNAPI文檔中宣布隨著Android 15(V)的推出即將淘汰NNAPI,未來將主推LiteRT (TensorFlow Lite)。本文摘要整理相關資料並描述Google這麼做的原因為何。
NNAPI will be Deprecated with the release of Android 15 (Android-V)
根據NNAPI的google最新document描述到:
Warning: With the release of Android 15, NNAPI will be deprecated. While you can continue to use NNAPI, we expect the majority of devices in the future to use the CPU backend, and therefore for performance critical workloads, we recommend migrating to alternative solutions, for example the TF Lite GPU runtime.
For more information, see the NNAPI Migration Guide.

而在NNAPI migration guide中則說明了原因:
- 自從NNAPI release後, 由於ODML (On Device Machine Learning)的快革新, 如transformer, diffusion等model的快速進版, 開發者需要頻繁的更新基礎工具和開發工具
- 為了滿足這些需求, Google提供了TensorFlow Lite (LiteRT) in Play Services, 為這些AI模型提供了可更新的TensorFlow runtime服務
並且提及在Android 15 (Android-V)後, NNAPI將被標記為棄用(deprecated)並建議開發者改採用TensorFlow Lite (LiteRT) in Play Services
LiteRT = TensorFlow Lite Runtime

LiteRT (TensorFlow Lite RunTime) 其實就是大家熟悉的TensorFlow Lite, 只是改名了
Posted by John on
2025-03-10