simian 0.2.0

A command-line tool for exploring and implementing Machine Learning algorithms in Rust.
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
#[derive(Clone, Debug, PartialEq)]
pub enum Device {
  Cpu,
  Cuda(usize),
  Metal(usize),
}

impl Device {
  pub fn as_candle(&self) -> candle_core::Result<candle_core::Device> {
    match self {
      Device::Cpu => Ok(candle_core::Device::Cpu),
      Device::Cuda(idx) => candle_core::Device::new_cuda(*idx),
      Device::Metal(idx) => candle_core::Device::new_metal(*idx),
    }
  }
}