Operate with the default flatbuffer_direct backend while preserving production stability and diagnosability, and keep tf_converter available only as an explicit compatibility path when needed.
| Item | tf_converter |
flatbuffer_direct |
|---|---|---|
| Default | No (explicit fallback) | Yes |
| Final generation path | TensorFlow Lite Converter | Direct FlatBuffer builder |
| Optimization behavior | TF-path accumulated rewrites/heuristics | Direct preprocess + strict dispatch constraints |
| Failure model | Many patterns absorbed by TF conversion | Explicit failure with reason_code |
| Custom op path | Implicitly minimized by TF path | Explicit opt-in + allowlist |
| Fallback | N/A | N/A (no fallback) |
- Keep the default CI lane on
flatbuffer_directand enable--report_op_coveragethere. - Add an explicit compatibility lane with
--tflite_backend tf_converterif you still need to monitor legacy behavior. - Resolve direct-path failures by
reason_codeand adjust model/export options. - Only after stable float32/float16 conversion, enable quantization and split evaluation.
python -m onnx2tf.onnx2tf \
-i model.onnx \
-o out \
--report_op_coveragepython -m onnx2tf.onnx2tf \
-i model.onnx \
-o out \
-odrqt -oiqt \
--eval_with_onnx \
--eval_target_tflite full_integer_quant \
--eval_compare_mode dequant \
--report_op_coveragepython -m onnx2tf.onnx2tf \
-i model.onnx \
-o out \
--auto_split_tflite_by_size \
--tflite_split_target_bytes 1060000000 \
--tflite_split_max_bytes 1073741824 \
--eval_split_models \
--report_op_coveragepython -m onnx2tf.onnx2tf \
-i model.onnx \
-o outWhen direct export fails, conversion stops with an explicit error. Use tf_converter explicitly if the legacy TensorFlow Lite Converter path is still required operationally.
flatbuffer_direct applies staged preprocess rules before lowering:
pattern_fusion_wave2- ReLU/Clip chain normalization
- GELU chain fusion
- SpaceToDepth chain fusion
pseudo_ops_wave1- HardSwish / LeakyRelu / PRelu / Gelu / limited Pow rewrites
constant_fold_a5- Limited constant folding for shape/axes and arithmetic helper chains
normalize_attrs_a5perm/axesnormalization and softmax-axis bridge insertion
Use preprocess_report.applied_rules in *_op_coverage_report.json to inspect actual rewrites.
Use custom-op lowering only when builtin mapping is not feasible.
python -m onnx2tf.onnx2tf \
-i model.onnx \
-o out \
--tflite_backend flatbuffer_direct \
--flatbuffer_direct_allow_custom_ops \
--flatbuffer_direct_custom_op_allowlist Einsum,TopK \
--report_op_coverageBehavior:
- Without custom-op enablement, custom candidates fail with
reason_code=custom_op_candidate_disabled. - If allowlist is specified and op is missing, conversion fails with
reason_code=custom_op_not_in_allowlist.
Symptom (reason_code) |
Cause | Mitigation |
|---|---|---|
unsupported_onnx_op |
No direct builtin/custom path | Use tf_converter or model rewrite |
requires_constant_input |
Dynamic axes/perm/shape where constants are required | Pre-fold graph (onnxsim) or rewrite to constants |
unsupported_attribute_value |
Direct constraints unmet (axis/rank/mode) | Adjust exporter flags or rewrite subgraph |
custom_op_candidate_disabled |
Custom candidate encountered while custom mode disabled | Enable custom ops only if runtime supports them |
custom_op_not_in_allowlist |
Candidate op not in allowlist | Add to allowlist explicitly |
- Accuracy report:
*_accuracy_report.json - Split plan:
*_split_plan.json - Split manifest:
*_split_manifest.json - Split accuracy:
*_split_accuracy_report.json - OP coverage:
*_op_coverage_report.json
- Keep the default
flatbuffer_directlane green at all times. - Keep an explicit
tf_converterlane only if you still rely on that compatibility path. - Gate
flatbuffer_directrollout by model family (small -> medium -> large). - Require
--report_op_coveragein CI for the direct lane. - Review
unsupported_reason_countsandcustom_op_policyfor every failure. - Avoid custom-op expansion unless runtime/serving side is ready.