Type Method

compileModel(at:)

Compile a model on device to install or update the model over the air.

Declaration

class func compileModel(at modelURL: URL) throws -> URL

Parameters

at

The file path to your downloaded .mlmodel file.

Return Value

The file path to the compiled model (the .mlmodelc file).

Discussion

Use this method to compile a model for your app. The model is compiled to a temporary location. To maintain access to the file move it to a more permanent location, such as your app's document directory. To create the new model, pass the compiled model to the init(contentsOf:) initializer.

Compiling can be time consuming and shouldn't be done on the main thread.

Beta Software

This documentation contains preliminary information about an API or technology in development. This information is subject to change, and software implemented according to this documentation should be tested with final operating system software.

Learn more about using Apple's beta software