TensorRank
TensorRank[tensor]
gives the rank of tensor.
Details and Options

- TensorRank accepts any type of tensor, either symbolic or explicit, including any type of array.
- On explicit rectangular arrays of scalars, TensorRank coincides with ArrayDepth. On symbolic arrays, TensorRank stays unevaluated unless the array has been assigned a rank through any form of assumption.
Examples
open allclose allBasic Examples (1)
Scope (3)
Properties & Relations (2)
On explicit arrays, TensorRank coincides with ArrayDepth:
Possible Issues (3)
TensorRank can obtain some information contextually. Expressions without tensor properties inside numeric functions, arrays, or derivatives are considered scalars:
It is not possible to mix incompatible local and global assumptions:

TensorRank does not check for dimensions homogeneity, only rank homogeneity:

This alternative construction would check for dimensions homogeneity:

Text
Wolfram Research (2012), TensorRank, Wolfram Language function, https://reference.wolfram.com/language/ref/TensorRank.html.
CMS
Wolfram Language. 2012. "TensorRank." Wolfram Language & System Documentation Center. Wolfram Research. https://reference.wolfram.com/language/ref/TensorRank.html.
APA
Wolfram Language. (2012). TensorRank. Wolfram Language & System Documentation Center. Retrieved from https://reference.wolfram.com/language/ref/TensorRank.html