def test_ntxent_loss(
    embeddings_left: torch.Tensor,
    embeddings_right: torch.Tensor,
    tau: float,
    true_value: float,
):
    """
    Test NTXent Loss

    Args:
        embeddings_left: left objects embeddings [batch_size, features_dim]
        embeddings_right: right objects embeddings [batch_size, features_dim]
        tau: temperature
        true_value: expected loss value
    """
    value = NTXentLoss(tau=tau)(embeddings_left, embeddings_right).item()
    assert np.isclose(value, true_value)

    Test NTXent Loss

    Args:
        embeddings_left: left objects embeddings [batch_size, features_dim]
        embeddings_right: right objects embeddings [batch_size, features_dim]
        tau: temperature
        true_value: expected loss value
    
tests/contrib/nn/test_criterion.py