TensorDimensions
TensorDimensions[tensor] gives the list of dimensions of tensor.
Examples
Dimensions of a matrix:
TensorDimensions[{{1, 2, 3}, {4, 5, 6}}]
(* {2, 3} *)Dimensions of a 3D array:
TensorDimensions[{{{1, 2}, {3, 4}}, {{5, 6}, {7, 8}}}]
(* {2, 2, 2} *)Please visit the official Wolfram Language Reference for more details.