def test_supervised_contrastive_loss(
    features: torch.Tensor,
    targets: torch.Tensor,
    tau: float,
    pos_aggregation: str,
    true_value: float,
):
    """
    Test supervised contrastive loss

    Args:
        features: features of objects
        targets: targets of objects
        pos_aggregation: aggeragation of positive objects
        tau: temperature
        true_value: expected loss value
    """
    value = SupervisedContrastiveLoss(tau=tau, pos_aggregation=pos_aggregation)(
        features, targets
    ).item()
    assert np.isclose(value, true_value)

    Test supervised contrastive loss

    Args:
        features: features of objects
        targets: targets of objects
        pos_aggregation: aggeragation of positive objects
        tau: temperature
        true_value: expected loss value
    
tests/contrib/nn/test_criterion.py