Compile-time shape tracking
R1<3>
is the shape parameter of the GraphTensor
.
Let’s break it down:
R1
: Represents the rank of the tensor, which is the number of dimensions it has.
In this case, R1
denotes a rank-1 tensor (a one-dimensional tensor).<3>
: Specifies the size of the tensor along its single dimension.
Here, <3>
means the tensor contains 3 elementsR1<3>
defines a one-dimensional tensor with 3 elements—a 3-dimensional vector.
R1<N>
) is implemented as a type alias for (Const<N>,)
,
where Const<N>
is a compile-time constant representing the size of the tensor.
This design allows Rust to enforce tensor shapes at compile time, ensuring that: