Add a specific example for cuda.

This commit is contained in:
laurent
2023-06-21 18:56:04 +01:00
parent 2bfe8f18ab
commit c654ecdb16
3 changed files with 34 additions and 11 deletions

9
examples/cuda_basics.rs Normal file
View File

@ -0,0 +1,9 @@
use anyhow::Result;
use candle::{DType, Device, Tensor};
fn main() -> Result<()> {
let device = Device::new_cuda(0)?;
let x = Tensor::zeros(4, DType::F32, device)?;
println!("{:?}", x.to_vec1::<f32>()?);
Ok(())
}