COSIE.loss.crossview_contrastive_Loss
- crossview_contrastive_Loss(view1, view2, gamma=9.0, EPS=2.220446049250313e-16)[source]
Compute the cross-view contrastive loss between two embedding views.
Parameters
- view1torch.Tensor
A tensor of shape (n_cells, dim) representing the first view’s features.
- view2torch.Tensor
A tensor of shape (n_cells, dim) representing the second view’s features. Must be the same shape as view1.
- gammafloat, optional
The weight applied to the entropy regularization term. Default is 9.0.
- EPSfloat, optional
A small constant used to avoid \(\log(0)\). Required for numerical stability. Default is sys.float_info.epsilon.
Returns
- losstorch.Tensor
A scalar tensor representing the contrastive loss.