def METHOD_NAME(x: Tensor, y: Tensor, eps: float = 1e-5) -> float:
    r"""Measures the ratio of inter-group distance over intra-group
    distance
    .. math::
        R_{\text{Group}} = \frac{\frac{1}{(C-1)^2} \sum_{i!=j}
        \frac{1}{|\mathbf{X}_i||\mathbf{X}_j|} \sum_{\mathbf{x}_{iv}
        \in \mathbf{X}_i } \sum_{\mathbf{x}_{jv^{\prime}} \in \mathbf{X}_j}
        {\| \mathbf{x}_{iv} - \mathbf{x}_{jv^{\prime}} \|}_2 }{
        \frac{1}{C} \sum_{i} \frac{1}{{|\mathbf{X}_i|}^2}
        \sum_{\mathbf{x}_{iv}, \mathbf{x}_{iv^{\prime}} \in \mathbf{X}_i }
        {\| \mathbf{x}_{iv} - \mathbf{x}_{iv^{\prime}} \|}_2 }
    where :math:`\mathbf{X}_i` denotes the set of all nodes that belong to
    class :math:`i`, and :math:`C` denotes the total number of classes in
    :obj:`y`.
    """
    num_classes = int(y.max()) + 1
    numerator = 0.
    for i in range(num_classes):
        mask = y == i
        dist = torch.cdist(x[mask].unsqueeze(0), x[~mask].unsqueeze(0))
        numerator += (1 / dist.numel()) * float(dist.sum())
    numerator *= 1 / (num_classes - 1)**2
    denominator = 0.
    for i in range(num_classes):
        mask = y == i
        dist = torch.cdist(x[mask].unsqueeze(0), x[mask].unsqueeze(0))
        denominator += (1 / dist.numel()) * float(dist.sum())
    denominator *= 1 / num_classes
    return numerator / (denominator + eps)