I was having a weird problem that I was able to simplify to this example:
import numba as nb
import numpy as np
from numpy import testing
@nb.njit
def in_range(arr, mn, mx):
if mn is None and mx is None:
return np.full(arr.shape, True)
if mx is None:
return mn <= arr
if mn is None:
return arr < mx
return np.logical_and(mn <= arr, arr < mx)
print(nb.version_info)
arr = np.asarray((1, 4, 5, 8))
# 1
testing.assert_array_equal(in_range(arr, None, None),
np.asarray([True, True, True, True]))
# 2
testing.assert_array_equal(in_range(arr, 4, None),
np.asarray([False, True, True, True]))
# 3
testing.assert_array_equal(in_range(arr, None, 4),
np.asarray([True, False, False, False]))
# 4
testing.assert_array_equal(in_range(arr, 4, 7),
np.asarray([False, True, True, False]))
and I am getting:
No implementation of function Function(<built-in function le>) found for signature:
>>> le(none, array(int64, 1d, C))
This example works fine if I comment @nb.njit
. It seems that #3 is trying to reuse an implementation with the wrong types. I am using Numba 0.53