Loss wrappers

Sample pairs and triplets out of conventional (outputs, labels) batches.

ContrastiveLossSampler(criterion[, ...])

Contrastive Loss [R2d1cdae5627d-1] with random sampling of vector pairs out of the conventional (outputs, labels) batch.

TripletLossSampler(criterion[, pairs_multiplier])

TripletLoss [Rfe594912252b-1] with random sampling of triplets out of the conventional (outputs, labels) batch.

Loss functions not included in PyTorch.

TripletCosineLoss([margin])

Creates a criterion that measures the cosine triplet loss given an input tensors x1, x2, x3 and a margin with a value greater than 0.