COSIE.loss.compute_joint

compute_joint(view1, view2)[source]

Compute the symmetric joint probability matrix between two views (embeddings), commonly used in contrastive learning objectives.

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.

Returns

p_i_j: torch.Tensor

A (dim, dim) joint probability matrix \(p_{i,j}\), normalized and symmetrized. Each entry represents the co-occurrence probability of feature dimensions across the two views.