Garfield.modules.compute_contrastive_instanceloss
- Garfield.modules.compute_contrastive_instanceloss(z_i, z_j, temperature)[source]
Compute the contrastive loss given two batches of feature vectors z_i and z_j.
Parameters: z_i (Tensor): Feature vectors from the first view. z_j (Tensor): Feature vectors from the second view. temperature (float): Temperature parameter to scale the dot products.
Returns: loss (Tensor): The computed contrastive loss.