mirror of
https://github.com/huggingface/candle.git
synced 2025-06-17 11:08:52 +00:00
Add a specific example for cuda.
This commit is contained in:
9
examples/cuda_basics.rs
Normal file
9
examples/cuda_basics.rs
Normal 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(())
|
||||
}
|
Reference in New Issue
Block a user