# ConverterError: Quantization not supported for op 'Cumsum'. Op has no registered quantized kernel.

- **ID:** `tensorflow/tflite-converter-unsupported-op`
- **Domain:** tensorflow
- **Category:** build_error
- **Error Code:** `ETQU`
- **Verification:** ai_generated
- **Fix Rate:** 80%

## Root Cause

During TFLite conversion with quantization enabled, an operation (e.g., Cumsum, Gather, or TopK) does not have a quantized kernel implementation, causing the converter to fail.

## Version Compatibility

| Version | Status | Introduced | Deprecated |
|---------|--------|------------|------------|
| TensorFlow 2.7.0 | active | — | — |
| TFLite 2.7.0 | active | — | — |

## Workarounds

1. **Use selective quantization: apply quantization only to supported ops by using `converter.target_spec.supported_ops = [tf.lite.OpsSet.TFLITE_BUILTINS_INT8]` and exclude unsupported ops by falling back to float. Alternatively, use `converter.target_spec.supported_ops = [tf.lite.OpsSet.TFLITE_BUILTINS, tf.lite.OpsSet.SELECT_TF_OPS]` to allow select TensorFlow ops.** (85% success)
   ```
   Use selective quantization: apply quantization only to supported ops by using `converter.target_spec.supported_ops = [tf.lite.OpsSet.TFLITE_BUILTINS_INT8]` and exclude unsupported ops by falling back to float. Alternatively, use `converter.target_spec.supported_ops = [tf.lite.OpsSet.TFLITE_BUILTINS, tf.lite.OpsSet.SELECT_TF_OPS]` to allow select TensorFlow ops.
   ```
2. **If the unsupported op is critical, convert the model without quantization (set optimizations=[]) and then apply post-training quantization using a representative dataset that avoids the op, or use full-integer quantization with fallback.** (80% success)
   ```
   If the unsupported op is critical, convert the model without quantization (set optimizations=[]) and then apply post-training quantization using a representative dataset that avoids the op, or use full-integer quantization with fallback.
   ```
3. **Rewrite the model to avoid the unsupported op. For example, replace tf.math.cumsum with a loop or a different algorithm that uses supported ops like Add and Scan.** (70% success)
   ```
   Rewrite the model to avoid the unsupported op. For example, replace tf.math.cumsum with a loop or a different algorithm that uses supported ops like Add and Scan.
   ```

## Dead Ends

- **** — This may avoid the quantization error but results in a non-optimized model, losing the benefits of quantization (size reduction, speed). (60% fail)
- **** — Manual replacement is error-prone and may change model behavior; also, the custom op may not be supported in TFLite either. (80% fail)
- **** — Even in the latest versions, some ops still lack quantized kernels; upgrading alone does not guarantee support. (50% fail)
