Skip to content
DeepForgeby svx
All problems
EasyDeep Learningproj-034

Dense Class Scores

Problem

Compute class scores from a flattened feature vector.

W has shape num_classes x len(x) and b has length num_classes. Return W @ x + b as the raw logits for each class.

Hint

The classifier head is a single matrix-vector product plus bias.

Test cases

case 1
in: [[1,2],[[1,0],[0,1]],[0,0]]
expected: [1,2]
case 2
in: [[0.5],[[2]],[1]]
expected: [2]
case 3
in: [[1,-1],[[1,1]],[0]]
expected: [0]
case 4
in: [[1,2,3],[[1,0,1]],[0.5]]
expected: [4.5]
Starter codePython
def dense_scores(x, W, b):
    # Your code here
    pass

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