diff options
Diffstat (limited to 'candle-core/src/device.rs')
-rw-r--r-- | candle-core/src/device.rs | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/candle-core/src/device.rs b/candle-core/src/device.rs index 0ed23a18..d566ba42 100644 --- a/candle-core/src/device.rs +++ b/candle-core/src/device.rs @@ -128,6 +128,13 @@ impl Device { Ok(Self::Cuda(crate::CudaDevice::new(ordinal)?)) } + pub fn set_seed(&self, seed: u64) -> Result<()> { + match self { + Self::Cpu => crate::cpu_backend::CpuDevice.set_seed(seed), + Self::Cuda(c) => c.set_seed(seed), + } + } + pub fn same_device(&self, rhs: &Self) -> bool { match (self, rhs) { (Self::Cpu, Self::Cpu) => true, |