All problems
Dot Product Attention Scores
Problem
Unscaled attention scores are the dot products of a query with each key.
Given the query vector and the list of key vectors, return the score list.
Hint
One dot product per key.
Test cases
case 1
in: [[1,0],[[1,0],[0,1]]]
expected: [1,0]
case 2
in: [[1,1],[[1,1]]]
expected: [2]
case 3
in: [[0,1],[[1,0],[0,2],[1,1]]]
expected: [0,2,1]
Starter codePython
def dot_product_attention_scores(query, keys):
# Your code here
pass3 test cases · run your code against them in the editor