The best way to identify the shape of a array

Hi team,

How do we normally read shape of a array? is there a best way? In the following picture, the shape is (3,3,2)


I found is easier to read the shape from innermost to outmost, so I won’t misread numbers of “[ ]”. Like in the above, it has 2 columns and 3 row and 3 examples so the shape is (3,3,2)

Second question is what do we call each dimension in the multi-dimension array?

Like above it’s the same example but I added another “[ ]” which makes it to (1,3,3,2)
What do we call this? like in a normal 2d array(3,2), we can read as 3 rows and 2 columns.

1 Like

Hi @Bio_J

The way of reading the shape of an array can be different for each person. Personally, I read the shape from the outermost to the innermost dimensions. However, by simply using .shape you can get the dimensions.

For naming each dimension in a multi-dimensional array, there isn’t a strict standard, but there are common conventions:

  • 1D Array (Vector) → n-vector
  • 2D Array (Matrix) → Dimensions: rows and columns
  • 3D Array (Also called a tensor) → Dimensions: depth, rows, and columns
  • 4D and Higher Dimensional Arrays (Generally referred to as tensors) → Naming conventions can become more complex, with terms like batch, channels, depth, rows, columns, etc., depending on the context of the data.
5 Likes