Can't convert Core ML model to Onnx then to Tensorflow Lite
ML System Design practice on Codemia
Design recommenders, ranking systems and training pipelines the way ML interviews actually ask for them, with worked solutions.
Introduction
Trying to convert a Core ML model to ONNX and then to TensorFlow Lite usually fails because that conversion chain goes against the direction most tooling is designed for. Core ML is primarily a deployment format for Apple platforms, not a universal interchange format, so the most reliable solution is usually to go back to the original training framework and convert from there.
Why This Pipeline Breaks Down
Each model format makes different assumptions:
- Core ML targets Apple runtime execution
- ONNX is an interchange format between training and inference ecosystems
- TensorFlow Lite targets mobile and embedded TensorFlow runtimes
Moving from PyTorch or TensorFlow into ONNX is common. Moving from ONNX into Core ML is also supported in some workflows. But going from an already converted Core ML package back outward into ONNX and then into TFLite is much less standard and often unsupported for many operators.
The Better Strategy
If you still have the source model in PyTorch, TensorFlow, or another training framework, use that as the starting point.
Typical reliable routes are:
- PyTorch to ONNX to TensorFlow to TensorFlow Lite
- TensorFlow or Keras directly to TensorFlow Lite
- PyTorch to Core ML separately for iOS deployment
In other words, treat Core ML and TensorFlow Lite as sibling deployment targets, not as stepping stones to each other.
Example: Convert From TensorFlow Directly
If the original model is in TensorFlow or Keras, the direct TFLite conversion path is simple.
This avoids the entire Core ML and ONNX detour.
Example: Convert From PyTorch Via ONNX
If the original model is in PyTorch and you need a TensorFlow Lite output, export ONNX from PyTorch rather than from Core ML.
From there, you can use ONNX-to-TensorFlow tooling or another supported bridge. The critical point is that the export starts from the framework that still has the real graph semantics.
Why Reverse Conversion Is Hard
By the time a model becomes Core ML, some graph information may have been rewritten, fused, or represented in ways that do not map cleanly back to ONNX. Even when a converter exists, it may fail on:
- custom operators
- unsupported layer types
- dynamic shapes
- fused preprocessing or postprocessing blocks
- quantization metadata specific to the target runtime
This is not just a tooling inconvenience. It is a mismatch in intended format direction.
Practical Decision Rule
If you need to deploy the same model to both Apple devices and TensorFlow Lite targets, keep the original training checkpoint or framework model as the source of truth. Then produce separate exports for each target platform.
That makes debugging much easier because each converter sees the model before target-specific transformations are baked in.
Common Pitfalls
The most common mistake is treating Core ML as a neutral exchange format. It is optimized for Apple inference, not as a universal bridge to every other ecosystem.
Another mistake is stacking multiple lossy conversions and expecting full operator compatibility at the end. Every conversion step introduces another place for semantic drift or unsupported ops.
A third issue is discarding the original training model too early. Once the source graph is gone, deployment flexibility drops sharply.
Summary
- Core ML to ONNX to TensorFlow Lite is usually an unreliable conversion path.
- The most dependable approach is to convert from the original training framework instead.
- Treat Core ML and TensorFlow Lite as separate deployment targets, not as intermediate formats for each other.
- Reverse conversion often fails because operators and graph semantics do not map cleanly backward.
- Keep the original model checkpoint or framework export as the source of truth.
Related reading
- Can't determine input shape and type of Convolutional Layer in Keras
- Can't import frozen graph with BatchNorm layer
- Can't import tensorflow.keras in VS Code
- Can't install tensorflow-io on m1
- Can't save custom subclassed model
- Can't save/load model using keras.load_model - IndexError list index out of range
- Can't install tensorflow with pip or anaconda
- Can't launch TensorBoard from CMD
.png&w=3840&q=75)
Tackling System Design Interview Problems
A short course that equips you with the skills to approach system design interviews methodically.
Start the free courseNo course covers this one yet
Basis Lab writes one for you from a sentence about what you want to be able to do, then teaches it and checks you understood. Your first course is free.
Build my courseML System Design practice on Codemia
Design recommenders, ranking systems and training pipelines the way ML interviews actually ask for them, with worked solutions.