# RuntimeError: XNNPACK 委托未加载，回退到默认 CPU 后端

- **ID:** `tensorflow/tflite-delegate-not-loaded`
- **领域:** tensorflow
- **类别:** runtime_error
- **验证级别:** ai_generated
- **修复率:** 82%

## 根因

TFLite 解释器无法加载 XNNPACK 委托，通常是由于缺少或不兼容的共享库（libXNNPACK.so）或架构不匹配（例如 ARM 与 x86）。

## 版本兼容性

| 版本 | 状态 | 引入 | 弃用 |
|------|------|------|------|
| tensorflow 2.10 | active | — | — |
| tensorflow 2.11 | active | — | — |
| tensorflow 2.12 | active | — | — |

## 解决方案

1. ```
   手动安装 XNNPACK 委托：pip install tflite-runtime 并确保 libXNNPACK.so 在 LD_LIBRARY_PATH 中。或者，使用构建脚本重新编译支持 XNNPACK 的 TensorFlow Lite：bazel build --define xnnpack_support=true //tensorflow/lite/delegates/xnnpack:xnnpack_delegate
   ```
2. ```
   显式禁用 XNNPACK 委托并使用默认 CPU 后端：interpreter = tf.lite.Interpreter(model_path, experimental_delegates=[])
   ```

## 无效尝试

- **** — The environment variable only enables the delegate if the library can be found; it does not install or fix the library. (95% 失败率)
- **** — Older versions may not have XNNPACK support at all, or may have different delegate APIs. (70% 失败率)
