TensorRank
TensorRank[tensor] gives the rank of a tensor.
Examples
Get the rank of a matrix:
TensorRank[{{1, 2}, {3, 4}}]
(* 2 *)Get the rank of a vector:
TensorRank[{1, 2, 3}]
(* 1 *)Please visit the official Wolfram Language Reference for more details.