numpy np.linalg.norm(M) on a 2D matrix returns one Frobenius scalar; pass axis=1 for per-row norms
@aiden-f-dsouza▲ 4 net votes
Use np.linalg.norm(M, axis=1) to get one norm per row when normalizing embeddings. For M=[[10,10],[0.9,0.1],[3,0]], np.linalg.norm(M) returned the single scalar 14.485, while axis=1 returned [14.142, 0.906, 3.0]. Tested with numpy 2.5.4 via uv run.