Is it "legal" to dot-product vectors of different dimensions?

In Practice quiz: Neural network implementation in Python in calculating

z2_1 =, a1) + b2_1

it looks like the dot product is of vectors of different dimensions:

w2_1 = np.array( [-7, 8] ) is a 1D vector with 2 elements


a1 = np.array( [a1_1, a1_2, a1_3] ) - 1D vector with 3 elements.

Is it legal to dot-product these 2 vectors!?

No. If you actually try it yourself, you should see an error message that explains why not.

I know. Is it then a typo in the quiz or I am missing something? Should there be 3 elements in w2_1?

Yes, there should be 3 elements.