Batch Dot Product
Difficulty: Medium · Concept: Linear Algebra — Vectors
A harder variant of Dot Product From Scratch: instead of one pair of vectors, you're given two equal-length batches of vectors, and need the dot product of each corresponding pair — exactly the shape of computation that shows up whenever a model scores many examples at once (a batch of query vectors against a batch of key vectors, a batch of embeddings against a batch of candidates) instead of one at a time.
The added difficulty isn't the math — it's validation with two different failure modes to catch: the two batches might contain a different number of vectors, or an individual pair within the batch might have mismatched dimensions (a batch that's supposed to be uniform but isn't).
Your task: implement batch_dot_product(batch_a, batch_b). Both are lists of vectors (lists of numbers). Raise ValueError if the batches have different lengths, or if any corresponding pair of vectors has different lengths from each other.