mirror of
https://github.com/huggingface/candle.git
synced 2025-06-22 04:22:50 +00:00
Avoid some unnecessary returns.
This commit is contained in:
@ -25,13 +25,13 @@ impl BenchDevice for Device {
|
|||||||
}
|
}
|
||||||
|
|
||||||
pub(crate) fn device() -> Result<Device> {
|
pub(crate) fn device() -> Result<Device> {
|
||||||
return if cfg!(feature = "metal") {
|
if cfg!(feature = "metal") {
|
||||||
Device::new_metal(0)
|
Device::new_metal(0)
|
||||||
} else if cfg!(feature = "cuda") {
|
} else if cfg!(feature = "cuda") {
|
||||||
Device::new_cuda(0)
|
Device::new_cuda(0)
|
||||||
} else {
|
} else {
|
||||||
Ok(Device::Cpu)
|
Ok(Device::Cpu)
|
||||||
};
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
pub(crate) fn bench_name<S: Into<String>>(name: S) -> String {
|
pub(crate) fn bench_name<S: Into<String>>(name: S) -> String {
|
||||||
@ -39,7 +39,7 @@ pub(crate) fn bench_name<S: Into<String>>(name: S) -> String {
|
|||||||
}
|
}
|
||||||
|
|
||||||
const fn device_variant() -> &'static str {
|
const fn device_variant() -> &'static str {
|
||||||
return if cfg!(feature = "metal") {
|
if cfg!(feature = "metal") {
|
||||||
"metal"
|
"metal"
|
||||||
} else if cfg!(feature = "cuda") {
|
} else if cfg!(feature = "cuda") {
|
||||||
"cuda"
|
"cuda"
|
||||||
@ -49,5 +49,5 @@ const fn device_variant() -> &'static str {
|
|||||||
"mkl"
|
"mkl"
|
||||||
} else {
|
} else {
|
||||||
"cpu"
|
"cpu"
|
||||||
};
|
}
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user