Skip to content

Instantly share code, notes, and snippets.

@jamesonthecrow
Created March 5, 2019 04:41
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jamesonthecrow/a103af3bd258689d57e1a4d3d4146713 to your computer and use it in GitHub Desktop.
Save jamesonthecrow/a103af3bd258689d57e1a4d3d4146713 to your computer and use it in GitHub Desktop.
// PUT A BREAKPOINT HERE
// Compile the model.
let compiledModelURL = try! MLModel.compileModel(at: assetPath!)
// Initialize the model for use on a specific set of hardware
let config = MLModelConfiguration()
config.computeUnits = .all // can be .all, .cpuAndGPU, or .cpuOnly
let mlmodel = try! MLModel(contentsOf: compiledModelURL, configuration: config)
// Create a feature provider specific to your own model.
let inputFeatureProvider = // … You'll need to write some code here
// Run the model.
let result = try! model.prediction(from: inputFeatureProvider)
// PUT ANOTHER BREAKPOINT HERE
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment