mirror of
https://github.com/huggingface/candle.git
synced 2025-06-16 18:48:51 +00:00
10 lines
239 B
Rust
10 lines
239 B
Rust
use anyhow::Result;
|
|
use candle::{Device, Tensor};
|
|
|
|
fn main() -> Result<()> {
|
|
let x = Tensor::var(&[3f32, 1., 4.], &Device::Cpu)?;
|
|
let y = (((&x * &x)? + &x * 5f64)? + 4f64)?;
|
|
println!("{:?}", y.to_vec1::<f32>()?);
|
|
Ok(())
|
|
}
|