Use Core ML to integrate machine learning models into your app. Core ML provides a unified representation for all models. Your app uses Core ML APIs and user data to make predictions, and to train or fine-tune models, all on the user’s device.

Core ML optimizes on-device performance by leveraging the CPU, GPU, and Neural Engine while minimizing its memory footprint and power consumption. Running a model strictly on the user’s device removes any need for a network connection, which helps keep the user’s data private and your app responsive.


This page lists short code examples focused on how to use coremltools.

All of the examples link to the sections in the documentation or to Jupyter notebooks. The Jupyter notebooks can be run using Google Colab, which is a cloud-hosted notebook environment requiring no setup.

MLModel Examples

Utility Examples

MLModel Object and Spec Object

Neural Network

Model Evaluation Examples

Updatable Model Examples

Conversion Examples

Tensorflow Conversion Examples

Pytorch Conversion Examples

Other Framework Conversion Examples

Submit a Code Example

If you have a code example you'd like to submit, please adhere to the following requirements: