yamle.losses.contrastive module#
- class yamle.losses.contrastive.NoiseContrastiveEstimatorLoss(temperature=1.0, similarity='cosine', *args, **kwargs)[source]#
Bases:
BaseLossThis defines the noise contrastive estimation (NCE) loss.
It assumes that the input shape is (batch_size, num_members, num_classes). No matter what the reduction it is always averaged over the num_members.
- Parameters: