use ferrotensor::prelude::*;
fn main() {
let device = Device::best();
println!("device: {} ({})", device.name(), device.backend());
let x = Tensor::from_data(&[1., 2., 3., 4., 5., 6.], &[2, 3], &device);
let w = Tensor::from_data(&[0.5, -1., 2., 0., 1., 1.], &[3, 2], &device).requires_grad_();
let y = x.matmul(&w);
println!("x @ w = {:?} (shape {:?})", y.to_vec(), y.shape);
y.sum().backward();
println!("dL/dw = {:?}", w.grad().expect("w requires grad").to_vec());
}