Skip to content
DeepForgeby svx
All problems
MediumDeep Learningdl-249

Mask Query Decode

Problem

Decode a mask from a query embedding: the mask logit at each spatial position is the dot product between the query and that position's feature vector.

The signature is mask_query_decode(query, mask_features). Return the list of logits.

Hint

Mask queries act like dynamic convolution kernels over the feature map.

Test cases

case 1
in: [[1,0],[[1,2],[0,1],[2,2]]]
expected: [1,0,2]
case 2
in: [[0,1],[[1,2],[0,1],[2,2]]]
expected: [2,1,2]
case 3
in: [[1,1],[[1,2],[0,1],[2,2]]]
expected: [3,1,4]
case 4
in: [[2],[[1],[3]]]
expected: [2,6]
Starter codePython
def mask_query_decode(query, mask_features):
    # Your code here
    pass

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