def METHOD_NAME(gt_sorted):
    """ Compute gradient of the Lovasz extension w.r.t sorted errors. See Alg. 1 in paper. """
    gts = gt_sorted.sum()
    intersection = gts - gt_sorted.float().cumsum(0)
    union = gts + (1 - gt_sorted).float().cumsum(0)
    jaccard = 1.0 - intersection / union
    p = len(gt_sorted)
    if p > 1:  # cover 1-pixel case
        jaccard[1:p] = jaccard[1:p] - jaccard[0:-1]
    return jaccard