Skip to content

Commit

Permalink
fix(VisualRecognitionV3): temporary workaround for new A12 based devices
Browse files Browse the repository at this point in the history
  • Loading branch information
devinaconley authored and Anthony Oliveri committed Nov 12, 2018
1 parent 938bfd2 commit 62edd09
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion Source/VisualRecognitionV3/VisualRecognition+CoreML.swift
Original file line number Diff line number Diff line change
Expand Up @@ -279,7 +279,15 @@ extension VisualRecognition {
*/
private func loadModelFromDisk(classifierID: String) throws -> MLModel {
let modelURL = try locateModelOnDisk(classifierID: classifierID)
return try MLModel(contentsOf: modelURL)

// temporary workaround for compatibility issue with new A12 based devices
if #available(iOS 12.0, *) {
let modelConfig = MLModelConfiguration()
modelConfig.computeUnits = .cpuAndGPU
return try MLModel(contentsOf: modelURL, configuration: modelConfig)
} else {
return try MLModel(contentsOf: modelURL)
}
}

/// Convert results from Core ML classification requests into a `ClassifiedImages` model.
Expand Down

0 comments on commit 62edd09

Please sign in to comment.