tensor

Macro tensor 

Source
macro_rules! tensor {
    ( $x:expr ) => { ... };
}
Expand description

Variadic tensor creation macro

use crum::tensor;

let t3 = tensor![[
     [
           [1.0, 2.0, 3.0],
           [4.0, 5.0, 6.0]
     ],
     [
           [7.0, 8.0, 9.0],
           [10.0, 11.0, 12.0]
     ]
  ]];
  let t12 = tensor![[[[[[[[[[[[[8,4,5]]]]]]]]]]]]];

/* Output
Tensor { shape: [2, 2, 3], strides: [6, 3, 1], data: [1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0, 9.0, 10.0, 11.0, 12.0] }
Tensor { shape: [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 3], strides: [3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 1], data: [8, 4, 5] }
*/