# ConverterError: TFLite 转换失败：模型层 'conv2d' 的量化失败

- **ID:** `tensorflow/tflite-conversion-quantization-failed`
- **领域:** tensorflow
- **类别:** build_error
- **错误码:** `ETFLITE`
- **验证级别:** ai_generated
- **修复率:** 85%

## 根因

模型包含 TFLite 后训练量化不支持的操作或数据类型，例如不支持的激活函数或动态范围。

## 版本兼容性

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

## 解决方案

1. ```
   Use selective quantization: converter.optimizations = [tf.lite.Optimize.DEFAULT]; converter.target_spec.supported_types = [tf.float16]; then convert.
   ```
2. ```
   Disable quantization for problematic layers: converter.optimizations = [] and convert without optimization.
   ```
3. ```
   Replace unsupported ops with TFLite-compatible alternatives, e.g., replace tf.nn.relu6 with tf.nn.relu.
   ```

## 无效尝试

- **** — The converter cannot handle the incompatible ops, leading to crashes. (90% 失败率)
- **** — The model structure may not support post-conversion quantization. (80% 失败率)
