macro_rules! shape_ops {
($tensor:expr, $($op:ident$(($($arg:expr),*))?),+ $(,)?) => { ... };
}Expand description
Convenience macro for chaining shape operations 形状操作連鎖の便利マクロ
§Examples
use rustorch::prelude::Tensor;
use rustorch::shape_ops;
use rustorch::error::RusTorchResult;
fn main() -> RusTorchResult<()> {
let tensor = Tensor::from_vec(vec![1.0, 2.0, 3.0, 4.0], vec![2, 2, 1]);
// Using macro for concise chaining
let result = shape_ops!(tensor,
squeeze,
unsqueeze(1),
flatten
)?;
Ok(())
}