oa::ml::loss::triplet_margin
Compute the triplet margin loss mean(max(0, d(a, p) - d(a, n) + margin)) with L2 distances over the last axis. All three inputs share one [N, D] shape; swap (the donor’s distance exchange) is not part of this contract. Errors Returns an error for mismatched, empty, non-rank-two, or non-FP32 inputs, or when runtime recording fails.
Function Documentation
Compute the triplet margin loss mean(max(0, d(a, p) - d(a, n) + margin)) with L2 distances over the last axis. All three inputs share one [N, D] shape; swap (the donor’s distance exchange) is not part of this contract. Errors Returns an error for mismatched, empty, non-rank-two, or non-FP32 inputs, or when runtime recording fails.