Skip to content
DeepForgeby svx
All problems
MediumNLPnlp-378

Embedding Dot Product Matrix

Problem

Projecting a vector onto a matrix computes one dot product per row.

Given the matrix as nested rows and the vector, return the list of dot products.

Hint

One dot product per row.

Test cases

case 1
in: [[[1,0],[0,1]],[1,2]]
expected: [1,2]
case 2
in: [[[1,1,1]],[1,0,1]]
expected: [2]
case 3
in: [[[2,1]],[1,-1]]
expected: [1]
Starter codePython
def embedding_dot_product_matrix(matrix, vector):
    # Your code here
    pass

3 test cases · run your code against them in the editor