quaterion.loss.group_loss module¶
- class GroupLoss(distance_metric_name: Distance = Distance.COSINE)[source]¶
Bases:
SimilarityLoss
Base class for group losses.
- Parameters:
distance_metric_name – Name of the distance function, e.g.,
Distance
.
- forward(embeddings: Tensor, groups: LongTensor) Tensor [source]¶
- Parameters:
embeddings – shape: (batch_size, vector_length)
groups – shape: (batch_size,) - Groups, associated with embeddings
- Returns:
Tensor – zero-size tensor, loss value
- training: bool¶