summaryrefslogtreecommitdiff
path: root/examples/basics.rs
blob: d5d4f72b17613ec471aab6a0bc1b7eb3a3fbb338 (plain)
1
2
3
4
5
6
7
8
9
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(())
}