All problems
Contrastive Logits
Problem
Scale a CLIP similarity matrix by the learned temperature.
Return every entry divided by temperature, rounded to 4 decimal places.
Test cases
case 1
in: [[[1,2],[3,4]],2]
expected: [[0.5,1],[1.5,2]]
case 2
in: [[[0.5]],0.5]
expected: [[1]]
case 3
in: [[[2]],4]
expected: [[0.5]]
Starter codePython
def contrastive_logits(sim_matrix, temperature):
# Your code here
pass3 test cases · run your code against them in the editor