I am doing an assignment on matrices and gradients, where the final answer must be expressed as a row vector.
vr = np.array([1, 2, 3])
vrr = np.array([[1, 2, 3]])
Mathematically, a row vector should be a 1×3 matrix, so the shape (1,3) seems to match that idea. However, NumPy treats (3,) as a 1D array, and many operations, like dot products and gradients, seem to work with this form as well.
What I want to clarify:
Which of these is the true mathematical row vector?
Which one should I use when a question explicitly asks for a row vector gradient?
Is using shape
(3,)mathematically ambiguous compared to(1,3)?