Skip to content
DeepForgeby svx
All problems
MediumComputer Visioncv-389

BYOL Predictor Target

Problem

Compute the BYOL predictor-target loss.

L2-normalize the predictor output and the target projection, then return the squared Euclidean distance between the two unit vectors rounded to 4 decimal places.

Hint

For unit vectors the loss simplifies to 2 - 2 * cosine similarity.

Test cases

case 1
in: [[1,0],[1,0]]
expected: 0
case 2
in: [[1,0],[-1,0]]
expected: 4
case 3
in: [[1,0],[0,1]]
expected: 2
case 4
in: [[1,1],[1,0]]
expected: 0.5858
Starter codePython
def byol_target_loss(pred, target):
    # Your code here
    pass

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