hii:

distance_positive = (anchor - positive).pow(2).sum(1) distance_negative = (anchor - negative).pow(2).sum(1)


if you are considering L2 loss between two vectors, these lines seem to be wrong.  Can you recheck?