TechnologiesMachine Learning & AI

CoreML

iOSmacOStvOSwatchOSvisionOS

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.

  • Cl
    MLModeliOS 11.0+
    MLModel
  • Cl
    MLModelAssetiOS 16.0+
    A compiled model asset.
  • Cl
    MLModelCollection
    MLModelCollection
  • Pr
    MLCustomModeliOS 12.0+
    A protocol you implement to provide a model with your own prediction logic.
  • Pr
    MLWritableiOS 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.

  • Cl
    MLModelDescriptioniOS 11.0+
    A description of a model containing input, output, and state feature descriptions, optionally outputted features
  • Cl
    MLFeatureDescriptioniOS 11.0+
    Description of a feature
  • Cl
    MLParameterDescriptioniOS 13.0+
    Describes a model parameter along with a default value and any applicable constaint on the values.
  • St
    MLModelMetadataKey
    Keys to a dictionary that holds useful information about a model.
  • En
    MLModelStructureiOS 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.

  • Cl
    MLFeatureValueiOS 11.0+
    An immutable variant holding a data value of a supported MLFeatureType
  • St
    MLSendableFeatureValueiOS 18.0+
    A sendable feature value.
  • Pr
    MLFeatureProvideriOS 11.0+
    A protocol that supplies named feature values as a model's inputs or outputs.
  • Cl
    MLDictionaryFeatureProvideriOS 11.0+
    A concrete convenience class conforming to MLFeatureProvider.
  • En
    MLFeatureTypeiOS 11.0+
    Supported data type enumeration

Multidimensional Arrays and Tensors 13

Hold numeric, sequence, and tensor data passed through a model.

  • Cl
    MLMultiArrayiOS 11.0+
    Use `MLMultiArray` to store a multi-dimensional value.
  • En
    MLMultiArrayDataTypeiOS 11.0+
    The data type of scalars in the multi-array.
  • Cl
    MLSequenceiOS 12.0+
    An immutable container holding an ordered collection of feature values
  • Cl
    MLStateiOS 18.0+
    Handle to the state buffers.
  • St
    MLTensoriOS 18.0+
    A multi-dimensional array of numerical or Boolean scalars tailored to ML use cases, containing methods to perform
  • Pr
    MLTensorRangeExpressioniOS 18.0+
    A type that can be used to slice a dimension of a tensor. Don't use this type directly.
  • Pr
    MLTensorScalariOS 18.0+
    A type that represents the tensor scalar types supported by the framework. Don't use this type directly.
  • St
    MLShapedArrayiOS 15.0+
    MLShapedArray is a N-dimensional array with non-contiguous strides.
  • St
    MLShapedArraySliceiOS 15.0+
    A view into a contiguous region of a shaped array.
  • Pr
    MLShapedArrayProtocoliOS 15.0+
    Protocol for the shaped array and the slice of shaped array.
  • Pr
    MLShapedArrayRangeExpressioniOS 15.0+
    Declares a set of operations a range expression (e.g. 0 ..< 10) must implement in order to
  • Pr
    MLShapedArrayScalariOS 15.0+
    Declares a set of operations all the data types of MLShapedArray's element must implement.
  • En
    MLShapedArrayBufferLayoutiOS 18.0+
    Buffer layout enum

Feature Constraints 11

Describe the size, shape, and value limits a model places on its features.

  • Cl
    MLImageConstraintiOS 11.0+
    MLImageConstraint
  • Cl
    MLImageSizeiOS 12.0+
    An object that represents a discrete pixel width and height a model supports.
  • Cl
    MLImageSizeConstraintiOS 12.0+
    An object that describes the range or set of image sizes a model accepts.
  • En
    MLImageSizeConstraintTypeiOS 12.0+
    Constants that specify how a model constrains acceptable image sizes.
  • Cl
    MLMultiArrayConstraintiOS 11.0+
    Constraint describing expected MLMultiArray properties
  • Cl
    MLMultiArrayShapeConstraintiOS 12.0+
    An object that describes the allowed shapes for a multiarray feature.
  • En
    MLMultiArrayShapeConstraintTypeiOS 12.0+
    Constants that specify how a model constrains acceptable multiarray shapes.
  • Cl
    MLDictionaryConstraintiOS 11.0+
    MLDictionaryConstraint
  • Cl
    MLSequenceConstraintiOS 12.0+
    Constraint describing expected MLSequence properties
  • Cl
    MLStateConstraintiOS 18.0+
    Constraint of a state feature value.
  • Cl
    MLNumericConstraintiOS 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.

  • Pr
    MLBatchProvideriOS 12.0+
    Protocol for accessing a collection of feature providers
  • Cl
    MLArrayBatchProvideriOS 12.0+
    A concrete convenience class conforming to MLBatchProvider.
  • Cl
    MLPredictionOptionsiOS 11.0+
    MLPredictionOptions

Configuration and Compute Devices 10

Control where and how a model runs across the available compute hardware.

  • Cl
    MLModelConfigurationiOS 12.0+
    An object to hold options for loading a model.
  • En
    MLComputeUnitsiOS 12.0+
    Constants that specify which compute units, such as CPU, GPU, or Neural Engine, a model may use.
  • En
    MLComputeDeviceiOS 17.0+
    Represents a compute device capable of running machine learning computations
  • Pr
    MLComputeDeviceProtocoliOS 17.0+
    Protocol for representing a compute device. The represented device
  • Cl
    MLCPUComputeDeviceiOS 17.0+
    Represents a CPU compute device.
  • Cl
    MLGPUComputeDeviceiOS 17.0+
    Represents a GPU compute device.
  • Cl
    MLNeuralEngineComputeDeviceiOS 17.0+
    Represents a NeuralEngine compute device for inference of machine learning models.
  • Cl
    MLComputePlaniOS 17.4+
    A class representing the compute plan of a model.
  • St
    MLComputePolicyiOS 18.0+
    The compute policy determining what compute device, or compute devices, to execute ML workloads on.
  • St
    MLOptimizationHintsiOS 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.

  • Cl
    MLUpdateTaskiOS 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
  • Cl
    MLUpdateContextiOS 13.0+
    Provides context for the update process when the progress or completion handlers are invoked.
  • Cl
    MLUpdateProgressHandlersiOS 13.0+
    Allows applications to register for progress and completion handlers.
  • St
    MLUpdateProgressEventiOS 13.0+
    Events on which update task is capable of invoking progress handler.
  • Cl
    MLTaskiOS 13.0+
    Class that abstracts state transitions and basic task controls.
  • En
    MLTaskStateiOS 13.0+
    All possible states an MLTask can be in.
  • Cl
    MLKeyiOS 13.0+
    A class representing key used to store any value against
  • Cl
    MLMetricKeyiOS 13.0+
    A class to specify list of supported model update metrics.
  • Cl
    MLParameterKeyiOS 13.0+
    A class to specify list of supported model update parameters.

Custom Layers 1

Extend a model with your own layer implementations.

  • Pr
    MLCustomLayeriOS 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.

  • St
    MLModelErroriOS 11.0+
    An error type that describes failures that occur while loading or running a model.

Extends 18

IntRangeClosedRangePartialRangeFromPartialRangeUpToPartialRangeThroughUnsafeBufferPointerUnsafeMutableBufferPointerInt32Int8DoubleFloatFloat16Int16UInt8UInt16UInt32Bool
← Machine Learning & AI