# Lite Runtime 文档

在 Qualcomm^®^ Linux^®^ 和 Ubuntu 上使用 delegate 转换、优化和运行 Lite Runtime (LiteRT) 模型。

## LiteRT 概述

<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewbox="0 0 16 16" fill="none" aria-label="icon3">
  <path d="M8 2V14M3.33333 2H12.6667C13.403 2 14 2.59695 14 3.33333V12.6667C14 13.403 13.403 14 12.6667 14H3.33333C2.59695 14 2 13.403 2 12.6667V3.33333C2 2.59695 2.59695 2 3.33333 2Z" stroke="#2A2AEA" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"></path>
</svg> LiteRT 高级概述

提供 LiteRT 框架、架构、delegate、模型转换和量化方法以及示例应用程序的高级概述。

https://docs.qualcomm.com/doc/80-70022-54SC/topic/tflite-landing-page.html#qualcomm-linux-debug-guide

## 开始运行 LiteRT 模型

<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewbox="0 0 16 16" fill="none" aria-label="icon3">
  <path d="M8 2V14M3.33333 2H12.6667C13.403 2 14 2.59695 14 3.33333V12.6667C14 13.403 13.403 14 12.6667 14H3.33333C2.59695 14 2 13.403 2 12.6667V3.33333C2 2.59695 2.59695 2 3.33333 2Z" stroke="#2A2AEA" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"></path>
</svg> 运行 LiteRT 模型的前提条件

设置 Qualcomm 开发套件，将其升级到最新的可用软件版本，然后刷写软件镜像。

https://docs.qualcomm.com/doc/80-70022-54SC/topic/getting-started.html#getting-started

<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewbox="0 0 16 16" fill="none" aria-label="icon3">
  <path d="M8 2V14M3.33333 2H12.6667C13.403 2 14 2.59695 14 3.33333V12.6667C14 13.403 13.403 14 12.6667 14H3.33333C2.59695 14 2 13.403 2 12.6667V3.33333C2 2.59695 2.59695 2 3.33333 2Z" stroke="#2A2AEA" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"></path>
</svg> 使用基于 GStreamer 的 Qualcomm^®^ Intelligent Multimedia SDK 运行 LiteRT 模型

下载所需文件，并使用 gst-ai-classification 预编译示例应用程序在 Qualcomm 开发套件上运行 LiteRT 分类模型。

https://docs.qualcomm.com/doc/80-70022-54SC/topic/run-a-tensorflow-lite-model-using-the-gstreamer-based-qim-sdk.html#run-a-tensorflow-lite-model-using-the-gstreamer-based-qim-sdk

<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewbox="0 0 16 16" fill="none" aria-label="icon3">
  <path d="M8 2V14M3.33333 2H12.6667C13.403 2 14 2.59695 14 3.33333V12.6667C14 13.403 13.403 14 12.6667 14H3.33333C2.59695 14 2 13.403 2 12.6667V3.33333C2 2.59695 2.59695 2 3.33333 2Z" stroke="#2A2AEA" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"></path>
</svg> 使用本机 LiteRT 示例应用程序运行 LiteRT 模型

下载所需文件，并使用 label\_image 本机示例应用程序在 Qualcomm 开发套件上运行 LiteRT 分类模型。

https://docs.qualcomm.com/doc/80-70022-54SC/topic/run-a-tensorflow-lite-model-using-a-native-tensorflow-lite-sample-application.html#run-a-tensorflow-lite-model-using-a-native-tensorflow-lite-sample-application

## LiteRT 架构

<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewbox="0 0 16 16" fill="none" aria-label="icon3">
  <path d="M8 2V14M3.33333 2H12.6667C13.403 2 14 2.59695 14 3.33333V12.6667C14 13.403 13.403 14 12.6667 14H3.33333C2.59695 14 2 13.403 2 12.6667V3.33333C2 2.59695 2.59695 2 3.33333 2Z" stroke="#2A2AEA" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"></path>
</svg> LiteRT 设备端推理概述

了解 LiteRT 设备端推理如何加载模型，然后由解释器使用 delegate 解析和执行模型。

https://docs.qualcomm.com/doc/80-70022-54SC/topic/arch.html#tensorflow-lite-runtime

<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewbox="0 0 16 16" fill="none" aria-label="icon3">
  <path d="M8 2V14M3.33333 2H12.6667C13.403 2 14 2.59695 14 3.33333V12.6667C14 13.403 13.403 14 12.6667 14H3.33333C2.59695 14 2 13.403 2 12.6667V3.33333C2 2.59695 2.59695 2 3.33333 2Z" stroke="#2A2AEA" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"></path>
</svg> 使用 delegate 加速 LiteRT 模型

使用 delegate 在 CPU、GPU 和专用 Qualcomm 硬件（如 Qualcomm^®^ Adreno^™^ GPU 和 Qualcomm^®^ Hexagon^™^ Tensor Processor）上高效加速模型。

https://docs.qualcomm.com/doc/80-70022-54SC/topic/arch.html#delegates

<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewbox="0 0 16 16" fill="none" aria-label="icon3">
  <path d="M8 2V14M3.33333 2H12.6667C13.403 2 14 2.59695 14 3.33333V12.6667C14 13.403 13.403 14 12.6667 14H3.33333C2.59695 14 2 13.403 2 12.6667V3.33333C2 2.59695 2.59695 2 3.33333 2Z" stroke="#2A2AEA" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"></path>
</svg> Qualcomm^®^ AI Engine Direct delegate 接口

包含 `QnnTFLiteDelegate.h` 标头并链接相应的 Qualcomm^®^ Neural Network (QNN) delegate 库以确保应用程序兼容性。

https://docs.qualcomm.com/doc/80-70022-54SC/topic/arch.html#section-qsn-xjp-tbc

## 部署 LiteRT 模型

<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewbox="0 0 16 16" fill="none" aria-label="icon3">
  <path d="M8 2V14M3.33333 2H12.6667C13.403 2 14 2.59695 14 3.33333V12.6667C14 13.403 13.403 14 12.6667 14H3.33333C2.59695 14 2 13.403 2 12.6667V3.33333C2 2.59695 2.59695 2 3.33333 2Z" stroke="#2A2AEA" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"></path>
</svg> 使用预先优化的 LiteRT 模型

从开源社区或 Qualcomm AI Hub 下载并使用可立即部署的 LiteRT 模型。

https://docs.qualcomm.com/doc/80-70022-54SC/topic/tensorflow-lite-developer-workflow.html#use-an-existing-tensorflow-lite-model

<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewbox="0 0 16 16" fill="none" aria-label="icon3">
  <path d="M8 2V14M3.33333 2H12.6667C13.403 2 14 2.59695 14 3.33333V12.6667C14 13.403 13.403 14 12.6667 14H3.33333C2.59695 14 2 13.403 2 12.6667V3.33333C2 2.59695 2.59695 2 3.33333 2Z" stroke="#2A2AEA" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"></path>
</svg> 将 TensorFlow 模型转换为 LiteRT 模型

使用 Python API 和 `tflite_convert` 命令将模型转换为 LiteRT 格式。

https://docs.qualcomm.com/doc/80-70022-54SC/topic/tensorflow-lite-developer-workflow.html#convert-tensorflow-lite-models

<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewbox="0 0 16 16" fill="none" aria-label="icon3">
  <path d="M8 2V14M3.33333 2H12.6667C13.403 2 14 2.59695 14 3.33333V12.6667C14 13.403 13.403 14 12.6667 14H3.33333C2.59695 14 2 13.403 2 12.6667V3.33333C2 2.59695 2.59695 2 3.33333 2Z" stroke="#2A2AEA" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"></path>
</svg> 创建应用程序并运行推理

使用 LiteRT C++ API 创建应用程序，以加载 LiteRT 模型并运行推理。

https://docs.qualcomm.com/doc/80-70022-54SC/topic/tensorflow-lite-developer-workflow.html#run-inference

<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewbox="0 0 16 16" fill="none" aria-label="icon3">
  <path d="M8 2V14M3.33333 2H12.6667C13.403 2 14 2.59695 14 3.33333V12.6667C14 13.403 13.403 14 12.6667 14H3.33333C2.59695 14 2 13.403 2 12.6667V3.33333C2 2.59695 2.59695 2 3.33333 2Z" stroke="#2A2AEA" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"></path>
</svg> 开发定制的应用程序

使用基于 qtimltflite GStreamer 的插件开发您自己的应用程序并运行 LiteRT 模型。

https://docs.qualcomm.com/doc/80-70022-54SC/topic/tensorflow-lite-developer-workflow.html#develop-a-custom-application-to-run-the-tensorflow-lite-model

## 运行 LiteRT 示例应用程序

<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewbox="0 0 16 16" fill="none" aria-label="icon3">
  <path d="M8 2V14M3.33333 2H12.6667C13.403 2 14 2.59695 14 3.33333V12.6667C14 13.403 13.403 14 12.6667 14H3.33333C2.59695 14 2 13.403 2 12.6667V3.33333C2 2.59695 2.59695 2 3.33333 2Z" stroke="#2A2AEA" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"></path>
</svg> 运行 LiteRT 示例应用程序的前提条件

将模型、标签文件和示例图像下载并复制到设备，以运行 label\_image 示例应用程序。

https://docs.qualcomm.com/doc/80-70022-54SC/topic/sample-applications.html#download-models-and-sample-images

<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewbox="0 0 16 16" fill="none" aria-label="icon3">
  <path d="M8 2V14M3.33333 2H12.6667C13.403 2 14 2.59695 14 3.33333V12.6667C14 13.403 13.403 14 12.6667 14H3.33333C2.59695 14 2 13.403 2 12.6667V3.33333C2 2.59695 2.59695 2 3.33333 2Z" stroke="#2A2AEA" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"></path>
</svg> 使用可用的 delegate 运行 LiteRT 模型

使用 delegate（如 XNNPACK 和 GPU）运行 LiteRT 模型，以对模型执行情况进行基准测试。

https://docs.qualcomm.com/doc/80-70022-54SC/topic/sample-applications.html#label-image-tool

<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewbox="0 0 16 16" fill="none" aria-label="icon3">
  <path d="M8 2V14M3.33333 2H12.6667C13.403 2 14 2.59695 14 3.33333V12.6667C14 13.403 13.403 14 12.6667 14H3.33333C2.59695 14 2 13.403 2 12.6667V3.33333C2 2.59695 2.59695 2 3.33333 2Z" stroke="#2A2AEA" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"></path>
</svg> 使用外部 delegate 运行 QNN delegate

使用 Qualcomm AI Engine Direct API 作为外部 delegate，以及相关库，用于运行 QNN delegate。

https://docs.qualcomm.com/doc/80-70022-54SC/topic/sample-applications.html#run-qnn-delegate-using-the-external-delegate-interface

## 编译 LiteRT

<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewbox="0 0 16 16" fill="none" aria-label="icon3">
  <path d="M8 2V14M3.33333 2H12.6667C13.403 2 14 2.59695 14 3.33333V12.6667C14 13.403 13.403 14 12.6667 14H3.33333C2.59695 14 2 13.403 2 12.6667V3.33333C2 2.59695 2.59695 2 3.33333 2Z" stroke="#2A2AEA" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"></path>
</svg> 可选：编译 LiteRT

在特定场景下重新编译 LiteRT，例如当您想要更改 LiteRT 库版本时。

https://docs.qualcomm.com/doc/80-70022-54SC/topic/build-qualcomm-linux-and-install-tensorflow-lite-runtime.html#build-qualcomm-linux-and-install-tensorflow-lite-runtime

Last Published: Nov 05, 2025

[Next Topic
LiteRT 概述](https://docs.qualcomm.com/bundle/publicresource/80-70022-54SC/topics/tflite-landing-page.md)