CosineSimilarityLoss¶
- class mmpretrain.models.losses.CosineSimilarityLoss(shift_factor=0.0, scale_factor=1.0)[源代码]¶
Cosine similarity loss function.
Compute the similarity between two features and optimize that similarity as loss.
- 参数:
- forward(pred, target, mask=None)[源代码]¶
Forward function of cosine similarity loss.
- 参数:
pred (torch.Tensor) – The predicted features.
target (torch.Tensor) – The target features.
- 返回:
The cosine similarity loss.
- 返回类型: