Compute the output of the last step of attention: the weighted sum of the value vectors using precomputed attention weights. weights has shape (n_queries, n_keys) and values has shape (n_keys, d_v).
Implement solve(weights, values).
Returns. Return a NumPy array of shape (n_queries, d_v): row i is ∑jwijvj.
Example 1
Input:
solve([[0.5, 0.5]], [[1.0, 2.0], [3.0, 4.0]])
Output:
[[2.0, 3.0]]
Example 2
Input:
solve([[1.0, 0.0], [0.25, 0.75]], [[10.0], [20.0]])
Output:
[[10.0], [17.5]]
No results yet
Run your code to check it against the examples, or submit to run every test.