Implement the triplet margin loss with squared L2 distances.
Signature: def triplet_loss(anchor: np.ndarray, positive: np.ndarray, negative: np.ndarray, margin: float = 1.0) -> float
Formula: max(0, ||a - p||^2 - ||a - n||^2 + margin)
Math
Asked at
Test Results