// SPDX-FileCopyrightText: 2026 Andrei G <bug-ops>
// SPDX-License-Identifier: MIT OR Apache-2.0
use candle_core::Device;
pub(crate) fn detect_device() -> Device {
#[cfg(feature = "metal")]
{
if let Ok(d) = Device::new_metal(0) {
return d;
}
}
#[cfg(feature = "cuda")]
{
if let Ok(d) = Device::new_cuda(0) {
return d;
}
}
Device::Cpu
}