mirror of
https://github.com/huggingface/candle.git
synced 2025-06-17 19:18:50 +00:00
Use a reference for the device.
This commit is contained in:
@ -2,7 +2,7 @@ use anyhow::Result;
|
||||
use candle::{Device, Tensor};
|
||||
|
||||
fn main() -> Result<()> {
|
||||
let x = Tensor::var(&[3f32, 1., 4.], Device::Cpu)?;
|
||||
let x = Tensor::var(&[3f32, 1., 4.], &Device::Cpu)?;
|
||||
let y = (((&x * &x)? + &x * 5f64)? + 4f64)?;
|
||||
println!("{:?}", y.to_vec1::<f32>()?);
|
||||
Ok(())
|
||||
|
Reference in New Issue
Block a user