mirror of
https://github.com/GayPizzaSpecifications/stable-diffusion-rpc.git
synced 2025-08-04 05:51:32 +00:00
27 lines
676 B
Swift
27 lines
676 B
Swift
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
|
|
}
|
|
}
|
|
}
|