There is no standard for how to order the elements in a tensor during vectorization. There, is, however, a standard nomenclature: you can use a row-major or column-major order.
Let’s first understand these concepts for matrices, then generalize them to higher-order tensors. So consider a matrix M
There are two ways to imagine
or of columns
where
We say that
Extension to higher-rank tensors
The key to extending this reasoning to higher-rank tensors is in which index advances more slowly:
- Row-major ordering advances the left (row) index more slowly.
- Column-major ordering advances the right (column) index more slowly.
Generalizing this to higher dimensions, we can say that:
- Row-major ordering advances indices from right-to-left; and
- Column-major ordering advances indices from left-to-right.
For example, consider a rank-3 tensor
The above representation can be seen as a (row) vector of matrices
But we could also think of
which we could expand (somewhat unnaturally) as
It should be noted that the first representation, which is analogous to row-major ordering, feels much more natural. Still, the choice of row- or column-major order is application specific, so we must not make assumptions.
Reading
The same logic could be extended to arbitrarily high dimension.