How tensor printing works for high-dimensional arrays
masterArraymancer supports pretty-printing tensors of arbitrary dimensionality. The representation follows a pattern based on whether the dimension rank is odd or even:
- Odd dimensions (e.g., rank 1, 3, 5): Represented as horizontal stacks of the pretty-printed (N-1) dimension.
- Even dimensions (e.g., rank 2, 4): Represented as vertical stacks of the pretty-printed (N-1) dimension.
To improve readability, separators (| and -) are used between stacks, and indices for each dimension are printed at the top (for odd dimensions) or left (for even dimensions) of the layer.
import arraymancer
let t1 = toSeq(1..144).toTensor().reshape(2,3,4,3,2)
echo t1