Skip to content

RusTorch v0.6.28 - tensor_nd! Procedural Macro for N-Dimensional Tensors

Choose a tag to compare

@JunSuzukiJapan JunSuzukiJapan released this 01 Oct 07:10
· 3 commits to main since this release
3c48f02

RusTorch v0.6.28 Release

πŸ†• New Features

tensor_nd! Procedural Macro

Introduces a powerful new procedural macro for creating N-dimensional tensors with compile-time shape inference.

use rustorch::tensor_nd;

// 4D tensor: shape [2, 2, 2, 2]
let t4 = tensor_nd!([
    [[[1, 2], [3, 4]], [[5, 6], [7, 8]]],
    [[[9, 10], [11, 12]], [[13, 14], [15, 16]]]
]);

// 6D tensor: shape [1, 1, 1, 1, 1, 2]
let t6 = tensor_nd!([[[[[[1, 2]]]]]]);

✨ Key Features

  • πŸ“¦ Support for N-dimensional tensors (1D through 8D and beyond)
  • πŸ” Compile-time shape inference from nested array literals
  • πŸ”„ Automatic numeric type conversion to f32
  • 🎯 Mixed numeric types support (integers and floats)
  • πŸ—οΈ New rustorch-macros workspace member for procedural macros

πŸ§ͺ Testing

  • βœ… 10 integration tests covering dimensions 1D through 8D
  • βœ… All 1143 library tests passing
  • βœ… Full example suite verified

πŸ“š Documentation

  • Comprehensive doc tests and examples
  • Updated README with usage examples
  • Release workflow documentation

πŸ”§ Technical Implementation

  • Uses syn, quote, and proc-macro2 for macro implementation
  • Recursive array flattening algorithm
  • Re-exported in main rustorch crate for easy access

πŸ“¦ Installation

Add to your Cargo.toml:

rustorch = "0.6.28"

πŸ”— Links

πŸ€– Generated with Claude Code

Co-Authored-By: Claude noreply@anthropic.com