resolve
fun resolve(requested: ComputeBackend, available: Set<ComputeBackend>, allowFallback: Boolean = true): ComputeBackend(source)
Resolves a requested backend to a concrete backend (never AUTO) given the set of backends the engine can actually use on this device. CPU_ONLY is always treated as available.
Rules:
AUTO resolves to the first entry of AUTO_PREFERENCE_ORDER contained in available.
A concrete backend contained in available resolves to itself.
Otherwise, if allowFallback is
true, the fallback chain is walked until an available backend is found (ending at CPU_ONLY).If allowFallback is
false, a BackendUnavailableException is thrown.
Parameters
available
backends supported by the engine on this device; AUTO entries are ignored.
Throws
if the requested backend is unavailable and fallback is disabled.