Skip to content

Commit 2309c97

Browse files
authored
Update array_utils.py (#303)
Increase tolerance from 1e-5 (default) to 1e-4 when checking sum_to_one
1 parent 7da1cfb commit 2309c97

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

baal/utils/array_utils.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ def to_prob(probabilities: np.ndarray):
1515
"""
1616
not_bounded = np.min(probabilities) < 0 or np.max(probabilities) > 1.0
1717
multiclass = probabilities.shape[1] > 1
18-
sum_to_one = np.allclose(probabilities.sum(1), 1)
18+
sum_to_one = np.allclose(probabilities.sum(1), 1, rtol=1e-4)
1919
if not_bounded or (multiclass and not sum_to_one):
2020
if multiclass:
2121
probabilities = softmax(probabilities, 1)

0 commit comments

Comments
 (0)