Skip to content
Snippets Groups Projects
Commit cc4abced authored by Amir MOHAMMADI's avatar Amir MOHAMMADI
Browse files

even linspace is buggy in numba

parent ec9947cf
No related branches found
No related tags found
1 merge request!100Python-only version of bob.measure
Pipeline #48348 passed
......@@ -731,10 +731,12 @@ def epc(
# if not pre-sorted, copies and sorts
dev_neg = dev_negatives if is_sorted else numpy.sort(dev_negatives)
dev_pos = dev_positives if is_sorted else numpy.sort(dev_positives)
# numpy.linspace is more stable than numpy.arange for non-integer steps
# using 1 + eps instead of 1.0 in numpy.linspace to avoid
# https://github.com/numba/numba/issues/6768
alpha = numpy.linspace(0, numpy.nextafter(1.0, 1.1), n_points)
# numpy.linspace is more stable than numpy.arange for non-integer steps.
# However, both arange and linspace are buggy in numba. Using objmode for a
# workaround. TODO(amir): remove objmode once
# https://github.com/numba/numba/issues/6768 is resolved.
with objmode(alpha="float64[:]"):
alpha = numpy.linspace(0, 1.0, n_points)
thres = numpy.empty_like(alpha)
mwer = numpy.empty_like(alpha)
for i, k in enumerate(alpha):
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment