Core ML runs and integrates trained machine learning models on device across iOS, macOS, tvOS, watchOS, and visionOS. You load a model as an MLModel and make predictions by passing features through types such as MLFeatureProvider, MLFeatureValue, and MLMultiArray, with MLFeatureDescription and MLModelDescription describing a model's inputs, outputs, and metadata. For higher throughput you run batch prediction through MLBatchProvider and MLArrayBatchProvider, and you control where computation runs with MLModelConfiguration, MLComputeUnits, and compute devices like MLCPUComputeDevice, MLGPUComputeDevice, and MLNeuralEngineComputeDevice. Protocols such as MLCustomLayer and MLCustomModel let you extend models with your own implementations.
Models 5
Load a trained machine learning model and inspect or extend its behavior.
- ClMLModeliOS 11.0+MLModel
- ClMLModelAssetiOS 16.0+A compiled model asset.
- ClMLModelCollectionMLModelCollection
- PrMLCustomModeliOS 12.0+A protocol you implement to provide a model with your own prediction logic.
- PrMLWritableiOS 13.0+A protocol for model types that can write themselves to a location on disk.
Model Description and Metadata 5
Examine a model's inputs, outputs, parameters, and descriptive metadata.
- ClMLModelDescriptioniOS 11.0+A description of a model containing input, output, and state feature descriptions, optionally outputted features
- ClMLFeatureDescriptioniOS 11.0+Description of a feature
- ClMLParameterDescriptioniOS 13.0+Describes a model parameter along with a default value and any applicable constaint on the values.
- StMLModelMetadataKeyKeys to a dictionary that holds useful information about a model.
- EnMLModelStructureiOS 17.4+An enum representing the structure of a model.
Feature Values and Providers 5
Represent and supply the feature values a model consumes and produces.
- ClMLFeatureValueiOS 11.0+An immutable variant holding a data value of a supported MLFeatureType
- StMLSendableFeatureValueiOS 18.0+A sendable feature value.
- PrMLFeatureProvideriOS 11.0+A protocol that supplies named feature values as a model's inputs or outputs.
- ClMLDictionaryFeatureProvideriOS 11.0+A concrete convenience class conforming to MLFeatureProvider.
- EnMLFeatureTypeiOS 11.0+Supported data type enumeration
Multidimensional Arrays and Tensors 13
Hold numeric, sequence, and tensor data passed through a model.
- ClMLMultiArrayiOS 11.0+Use `MLMultiArray` to store a multi-dimensional value.
- EnMLMultiArrayDataTypeiOS 11.0+The data type of scalars in the multi-array.
- ClMLSequenceiOS 12.0+An immutable container holding an ordered collection of feature values
- ClMLStateiOS 18.0+Handle to the state buffers.
- StMLTensoriOS 18.0+A multi-dimensional array of numerical or Boolean scalars tailored to ML use cases, containing methods to perform
- PrMLTensorRangeExpressioniOS 18.0+A type that can be used to slice a dimension of a tensor. Don't use this type directly.
- PrMLTensorScalariOS 18.0+A type that represents the tensor scalar types supported by the framework. Don't use this type directly.
- StMLShapedArrayiOS 15.0+MLShapedArray is a N-dimensional array with non-contiguous strides.
- StMLShapedArraySliceiOS 15.0+A view into a contiguous region of a shaped array.
- PrMLShapedArrayProtocoliOS 15.0+Protocol for the shaped array and the slice of shaped array.
- PrMLShapedArrayRangeExpressioniOS 15.0+Declares a set of operations a range expression (e.g. 0 ..< 10) must implement in order to
- PrMLShapedArrayScalariOS 15.0+Declares a set of operations all the data types of MLShapedArray's element must implement.
- EnMLShapedArrayBufferLayoutiOS 18.0+Buffer layout enum
Feature Constraints 11
Describe the size, shape, and value limits a model places on its features.
- ClMLImageConstraintiOS 11.0+MLImageConstraint
- ClMLImageSizeiOS 12.0+An object that represents a discrete pixel width and height a model supports.
- ClMLImageSizeConstraintiOS 12.0+An object that describes the range or set of image sizes a model accepts.
- EnMLImageSizeConstraintTypeiOS 12.0+Constants that specify how a model constrains acceptable image sizes.
- ClMLMultiArrayConstraintiOS 11.0+Constraint describing expected MLMultiArray properties
- ClMLMultiArrayShapeConstraintiOS 12.0+An object that describes the allowed shapes for a multiarray feature.
- EnMLMultiArrayShapeConstraintTypeiOS 12.0+Constants that specify how a model constrains acceptable multiarray shapes.
- ClMLDictionaryConstraintiOS 11.0+MLDictionaryConstraint
- ClMLSequenceConstraintiOS 12.0+Constraint describing expected MLSequence properties
- ClMLStateConstraintiOS 18.0+Constraint of a state feature value.
- ClMLNumericConstraintiOS 13.0+Allows enforcement of constraints on the values of update parameters.
Batch Prediction 3
Run predictions over many inputs at once for higher throughput.
- PrMLBatchProvideriOS 12.0+Protocol for accessing a collection of feature providers
- ClMLArrayBatchProvideriOS 12.0+A concrete convenience class conforming to MLBatchProvider.
- ClMLPredictionOptionsiOS 11.0+MLPredictionOptions
Configuration and Compute Devices 10
Control where and how a model runs across the available compute hardware.
- ClMLModelConfigurationiOS 12.0+An object to hold options for loading a model.
- EnMLComputeUnitsiOS 12.0+Constants that specify which compute units, such as CPU, GPU, or Neural Engine, a model may use.
- EnMLComputeDeviceiOS 17.0+Represents a compute device capable of running machine learning computations
- PrMLComputeDeviceProtocoliOS 17.0+Protocol for representing a compute device. The represented device
- ClMLCPUComputeDeviceiOS 17.0+Represents a CPU compute device.
- ClMLGPUComputeDeviceiOS 17.0+Represents a GPU compute device.
- ClMLNeuralEngineComputeDeviceiOS 17.0+Represents a NeuralEngine compute device for inference of machine learning models.
- ClMLComputePlaniOS 17.4+A class representing the compute plan of a model.
- StMLComputePolicyiOS 18.0+The compute policy determining what compute device, or compute devices, to execute ML workloads on.
- StMLOptimizationHintsiOS 17.4+A value that provides hints to optimize how a model is loaded and executed.
On-Device Model Updates 9
Personalize and retrain models on device, tracking progress and results.
- ClMLUpdateTaskiOS 13.0+Main class for setting up and controlling a model update. It provides some utility class methods for performing an update synchronously as well as class constructors for configuring an update and give
- ClMLUpdateContextiOS 13.0+Provides context for the update process when the progress or completion handlers are invoked.
- ClMLUpdateProgressHandlersiOS 13.0+Allows applications to register for progress and completion handlers.
- StMLUpdateProgressEventiOS 13.0+Events on which update task is capable of invoking progress handler.
- ClMLTaskiOS 13.0+Class that abstracts state transitions and basic task controls.
- EnMLTaskStateiOS 13.0+All possible states an MLTask can be in.
- ClMLKeyiOS 13.0+A class representing key used to store any value against
- ClMLMetricKeyiOS 13.0+A class to specify list of supported model update metrics.
- ClMLParameterKeyiOS 13.0+A class to specify list of supported model update parameters.
Custom Layers 1
Extend a model with your own layer implementations.
- PrMLCustomLayeriOS 11.2+A protocol you implement to provide a neural network layer with your own computation.
Errors 1
Handle failures that occur while loading or running a model.
- StMLModelErroriOS 11.0+An error type that describes failures that occur while loading or running a model.