Document API, make the implementation match the API, and update the same.

This commit is contained in:
2023-04-23 02:09:50 -07:00
parent 71afed326f
commit 7c0b2779f4
15 changed files with 707 additions and 310 deletions

View File

@ -0,0 +1,26 @@
import CoreML
import Foundation
public extension SdComputeUnits {
func toMlComputeUnits() -> MLComputeUnits {
switch self {
case .all: return .all
case .cpu: return .cpuOnly
case .cpuAndGpu: return .cpuAndGPU
case .cpuAndNeuralEngine: return .cpuAndNeuralEngine
default: return .all
}
}
}
public extension MLComputeUnits {
func toSdComputeUnits() -> SdComputeUnits {
switch self {
case .all: return .all
case .cpuOnly: return .cpu
case .cpuAndGPU: return .cpuAndGpu
case .cpuAndNeuralEngine: return .cpuAndNeuralEngine
default: return .all
}
}
}