Files
candle/candle-examples/src/lib.rs
Nicolas Patry dd06d93d0b Cleanup:
- Moved around book from `examples` to `candle-book` proper (overlapping
  the book and the lib structures)
2023-08-28 15:15:26 +02:00

18 lines
419 B
Rust

pub mod coco_classes;
pub mod imagenet;
pub mod object_detection;
use candle::{Device, Result, Tensor};
pub fn device(cpu: bool) -> Result<Device> {
if cpu {
Ok(Device::Cpu)
} else {
let device = Device::cuda_if_available(0)?;
if !device.is_cuda() {
println!("Running on CPU, to run on GPU, build this example with `--features cuda`");
}
Ok(device)
}
}