In the end, I solved with the following piece of code
    # x: (n, c, h, w) tensor -- t: threshold
    mask = x > t  # find values over threshold
    x[mask] = x[mask] / x[mask]  # peak these values to 1.
    x = x * (mask + ~mask.any(dim=1, keepdims=True))  # adjust to get prob again

that works for thresholds greater than 0.5.