mirror of
https://github.com/huggingface/candle.git
synced 2025-06-20 04:00:28 +00:00
Make the cuda rng seedable. (#1056)
This commit is contained in:
@ -223,6 +223,12 @@ impl BackendDevice for CudaDevice {
|
||||
})
|
||||
}
|
||||
|
||||
fn set_seed(&self, seed: u64) -> Result<()> {
|
||||
let mut curand = self.curand.lock().unwrap();
|
||||
curand.0.set_seed(seed).w()?;
|
||||
Ok(())
|
||||
}
|
||||
|
||||
fn location(&self) -> crate::DeviceLocation {
|
||||
crate::DeviceLocation::Cuda {
|
||||
gpu_id: self.device.ordinal(),
|
||||
|
Reference in New Issue
Block a user