1D Arrays Vs 2D Arrays

Try printing the shape of each of the arrays, e.g. by doing:

print(f"w.shape = {w.shape}")

What you will see is that the first one with double brackets will have a shape of (1,2). The second one with single brackets will have a shape if (2,).

So what that means it that the second one literally has only one dimension. So it is a “vector”, but it has no orientation as a “row vector” or a “column vector”. That idea doesn’t make sense with only 1 dimension. The 2D object is a row vector with dimensions 1 x 2. That is very different and that is what Prof Ng means by saying that the two are different.

1 Like