def recall(tp: int, fn: int, zero_division: int = 0) -> float:
    """Calculates recall (a.k.a. true positive rate) for binary classification
    and segmentation.

    Args:
        tp: number of true positives
        fn: number of false negatives
        zero_division: int value,
            should be one of 0 or 1; if both tp==0 and fn==0 return this
            value as s result

    Returns:
        recall value (0-1)
    """
    # originally recall is: tpr := tp / (tp + fn + eps)
    # but when both masks are empty this gives: tp=0 and fn=0 => tpr=0
    # so here recall is defined as tpr := 1 - fnr (false negative rate)
    if tp == 0 and fn == 0:
        return zero_division
    return 1 - fn / (fn + tp)
Calculates recall (a.k.a. true positive rate) for binary classification
    and segmentation.

    Args:
        tp: number of true positives
        fn: number of false negatives
        zero_division: int value,
            should be one of 0 or 1; if both tp==0 and fn==0 return this
            value as s result

    Returns:
        recall value (0-1)
    
catalyst/metrics/functional/_classification.py