Skip to main content

Model

Struct Model 

Source
pub struct Model {
    pub specification_version: i32,
    pub description: Option<ModelDescription>,
    pub is_updatable: bool,
    pub type: Option<Type>,
}
Expand description

A Core ML model, consisting of a specification version, a model description, and a model type.

Core ML model compatibility is indicated by a monotonically increasing specification version number, which is incremented anytime a backward-incompatible change is made (this is functionally equivalent to the MAJOR version number described by Semantic Versioning 2.0.0 <<http://semver.org/>_>).

Specification Versions : OS Availability (Core ML Version)

1 : iOS 11, macOS 10.13, tvOS 11, watchOS 4 (Core ML 1)

  • Feedforward & Recurrent Neural Networks
  • General Linear Models
  • Tree Ensembles
  • Support Vector Machines
  • Pipelines
  • Feature Engineering

2 : iOS 11.2, macOS 10.13.2, tvOS 11.2, watchOS 4.2 (Core ML 1.2)

  • Custom Layers for Neural Networks
  • Float 16 support for Neural Network layers

3 : iOS 12, macOS 10.14, tvOS 12, watchOS 5 (Core ML 2)

  • Flexible shapes and image sizes
  • Categorical sequences
  • Core ML Vision Feature Print, Text Classifier, Word Tagger
  • Non Max Suppression
  • Crop and Resize Bilinear NN layers
  • Custom Models

4 : iOS 13, macOS 10.15, tvOS 13, watchOS 6 (Core ML 3)

  • Updatable models
  • Exact shape / general rank mapping for neural networks
  • Large expansion of supported neural network layers
    • Generalized operations
    • Control flow
    • Dynamic layers
    • See NeuralNetwork.proto
  • Nearest Neighbor Classifier
  • Sound Analysis Prepreocessing
  • Recommender
  • Linked Model
  • NLP Gazeteer
  • NLP WordEmbedding

5 : iOS 14, macOS 11, tvOS 14, watchOS 7 (Core ML 4)

  • Model Deployment
  • Model Encryption
  • Unified converter API with PyTorch and Tensorflow 2 Support in coremltools 4
  • MIL builder for neural networks and composite ops in coremltools 4
  • New layers in neural network: - CumSum - OneHot - ClampedReLu - ArgSort - SliceBySize - Convolution3D - Pool3D - Bilinear Upsample with align corners and fractional factors - PixelShuffle - MatMul with int8 weights and int8 activations - Concat interleave - See NeuralNetwork.proto
  • Enhanced Xcode model view with interactive previews
  • Enhanced Xcode Playground support for Core ML models

6 : iOS 15, macOS 12, tvOS 15, watchOS 8 (Core ML 5)

  • Core ML Audio Feature Print
  • new type of model: mlprogram (MILSpec.Program)

7 : iOS 16, macOS 13, tvOS 16, watchOS 9 (Core ML 6)

  • FLOAT16 array data type
  • GRAYSCALE_FLOAT16 image color space.

8 : iOS 17, macOS 14, tvOS 17, watchOS 10 (Core ML 7)

  • iOS 17 ops
  • Scene print v2
  • ClassConfidenceThresholding model

9 : iOS 18, macOS 15, tvOS 18, watchOS 11 (Core ML 8)

  • multiple functions

10 : iOS 26, macOS 26, tvOS 26, watchOS 26, visionOS 26 (Core ML 9)

  • Int8 MultiArray types for ML Programs

Fields§

§specification_version: i32§description: Option<ModelDescription>§is_updatable: bool

Following model types support on-device update:

  • NeuralNetworkClassifier
  • NeuralNetworkRegressor
  • NeuralNetwork
  • KNearestNeighborsClassifier
§type: Option<Type>

start at 200 here model specific parameters:

Trait Implementations§

Source§

impl Clone for Model

Source§

fn clone(&self) -> Model

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for Model

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Default for Model

Source§

fn default() -> Self

Returns the “default value” for a type. Read more
Source§

impl Message for Model

Source§

fn encoded_len(&self) -> usize

Returns the encoded length of the message without a length delimiter.
Source§

fn clear(&mut self)

Clears the message, resetting all fields to their default.
Source§

fn encode(&self, buf: &mut impl BufMut) -> Result<(), EncodeError>
where Self: Sized,

Encodes the message to a buffer. Read more
Source§

fn encode_to_vec(&self) -> Vec<u8>
where Self: Sized,

Encodes the message to a newly allocated buffer.
Source§

fn encode_length_delimited( &self, buf: &mut impl BufMut, ) -> Result<(), EncodeError>
where Self: Sized,

Encodes the message with a length-delimiter to a buffer. Read more
Source§

fn encode_length_delimited_to_vec(&self) -> Vec<u8>
where Self: Sized,

Encodes the message with a length-delimiter to a newly allocated buffer.
Source§

fn decode(buf: impl Buf) -> Result<Self, DecodeError>
where Self: Default,

Decodes an instance of the message from a buffer. Read more
Source§

fn decode_length_delimited(buf: impl Buf) -> Result<Self, DecodeError>
where Self: Default,

Decodes a length-delimited instance of the message from the buffer.
Source§

fn merge(&mut self, buf: impl Buf) -> Result<(), DecodeError>
where Self: Sized,

Decodes an instance of the message from a buffer, and merges it into self. Read more
Source§

fn merge_length_delimited(&mut self, buf: impl Buf) -> Result<(), DecodeError>
where Self: Sized,

Decodes a length-delimited instance of the message from buffer, and merges it into self.
Source§

impl PartialEq for Model

Source§

fn eq(&self, other: &Model) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl StructuralPartialEq for Model

Auto Trait Implementations§

§

impl Freeze for Model

§

impl RefUnwindSafe for Model

§

impl Send for Model

§

impl Sync for Model

§

impl Unpin for Model

§

impl UnsafeUnpin for Model

§

impl UnwindSafe for Model

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.