Hi, I could not pass the test for the TripletLoss. Examining the test code, it seems it has a mistake here:
y_pred_perfect = ( [[1., 0.], [1., 0.]], [[1., 0.], [1., 0.]], [[0., 1.], [0., 1.]] )
loss = triplet_loss(y_true, y_pred_perfect, 3)
assert loss == 2., “Wrong value. Are you applying tf.reduce_sum to get the loss?”
For these inputs, pos_dist=0; neg_dist=1^2+1^2+1^2+1^2=4;
with alpha=3, that should yield loss=max(0,0-4+3)=0, not 2 ?!