Course 2, Week 3, one_hot_matrix error

Ok, sorry, I think I misinterpreted what the error message is saying. It is saying that it doesn’t like the “shape” argument you gave to reshape. It is just a scalar, but it needs to be at least a rank 1 array. Try [depth,] or [-1,].

In other words, the shape needs to really be what array.shape would give you for the resulting reshaped output object. That would be an array, not a scalar. A scalar doesn’t make any sense as a shape.

3 Likes