I am looking at [this lecture](https://youtu.be/6e65XfwmIWE?t=1175), which states (link to exact time):

> 
> What the triplet loss allows us in contrast to the contrastive loss is
> that we can learn a ranking. So it's not only about similarity, being
> closer together or being further apart, but now we want to learn how
> much closer am I compared to another image.
> 
> 
> 

The contrastive loss

$L(A, B) = y|f(A) - f(B)| + (1-y)max(0, m-|f(A) - F(B)|)$

would push similar samples together, and dissimilar samples apart.

The triplet loss

$L(A, P, N) = max(0, |f(A) - f(P)| - |f(A) - f(N)| + m) $

would push the positive close to the anchor, and the negative away from the anchor.

---

I fail to see why the quoted claim is or isn't true in either of these losses. To me, it looks like "same" samples are pushed together, and "different" samples are pushed apart by both.  

Furthermore, with the contrastive loss, the distance in the embedding space would be, as I understand it, the ranking- which is claimed to only exist with the triplet loss.

Is there a clearer reference for this, or just a simple answer?