def saliency_score(packed_data):
    """
    Helper function for saliency_map. This is used for a parallelized map()
    operation via multiprocessing.Pool()
    :param packed_data: tuple containing (point, point, gradients, target,
    other_classes, increase).
    : return: saliency score for the pair of points i, j. Either
    target_sum * abs(other_sum) if the conditions are met, or 0 otherwise.
    """

    # compute the saliency score for the given pair
    i, j, grads_target, grads_others, increase = packed_data
    target_sum = grads_target[i[0], i[1]] + grads_target[j[0], j[1]]
    other_sum = grads_others[i[0], i[1]] + grads_others[j[0], j[1]]

    # evaluate the saliency map conditions
    if ((increase and target_sum > 0 and other_sum < 0) or
       (not increase and target_sum < 0 and other_sum > 0)):
        return -target_sum * other_sum
    else:
        return 0