def test_cmc_score_with_samples(generate_samples_for_cmc_score):
    """
    Count cmc score callback for sets of well-separated data clusters labeled
    with error_rate probability mistake.
    """
    for (
        error_rate,
        query_embs,
        query_labels,
        gallery_embs,
        gallery_labels,
    ) in generate_samples_for_cmc_score:
        true_cmc_01 = 1 - error_rate
        conformity_matrix = (query_labels.reshape((-1, 1)) == gallery_labels).to(
            torch.bool
        )
        cmc = cmc_score(
            query_embeddings=query_embs,
            gallery_embeddings=gallery_embs,
            conformity_matrix=conformity_matrix,
            topk=1,
        )
        assert abs(cmc - true_cmc_01) <= 0.05

    Count cmc score callback for sets of well-separated data clusters labeled
    with error_rate probability mistake.
    
tests/catalyst/metrics/functional/test_cmc_metric.py