11_csv_numeric_loading/
11_csv_numeric_loading.rs1use matten::Tensor;
9
10fn main() -> Result<(), Box<dyn std::error::Error>> {
11 let t = Tensor::from_csv("1.0,2.0,3.0\n4.0,5.0,6.0\n")?;
13 println!(
14 "inline CSV: shape={:?} data={:?}",
15 t.shape(),
16 t.as_slice()
17 );
18
19 let t2 = Tensor::load_csv("examples/data/numeric_2x3.csv")?;
21 println!(
22 "from file: shape={:?} data={:?}",
23 t2.shape(),
24 t2.as_slice()
25 );
26
27 let t3 = Tensor::load_csv("examples/data/numeric_3x3.csv")?;
28 println!("3×3 from file: shape={:?}", t3.shape());
29
30 Ok(())
31}