oa::ml::loss::cosine_embedding
Compute the cosine embedding loss over [N, D] pairs. Rows with target == 1 contribute 1 - cos(x1, x2); rows with target == -1 contribute max(0, cos(x1, x2) - margin). target is an [N, 1] ±1 mask. Errors Returns an error for mismatched, empty, non-rank-two, or non-FP32 inputs, or when runtime recording fails.
Function Documentation
Compute the cosine embedding loss over [N, D] pairs. Rows with target == 1 contribute 1 - cos(x1, x2); rows with target == -1 contribute max(0, cos(x1, x2) - margin). target is an [N, 1] ±1 mask. Errors Returns an error for mismatched, empty, non-rank-two, or non-FP32 inputs, or when runtime recording fails.