Cannot find core `_helperlib` methods in custom overloaded methods

The following:

@overload_method(RandomStateNumbaType, "normal")
def numba_normal_dist(rng, a, b):
    def normal(rng, a, b):
        ptr = numba._helperlib.rnd_get_np_state_ptr()
        numba._helperlib.rnd_set_state(ptr, (rng.pos, rng.state_key))
        return np.random.normal(a,b)
    return normal

Fails with error,

TypingError: Failed in nopython mode pipeline (step: nopython frontend)
    Unknown attribute 'rnd_get_np_state_ptr' of type Module(<module 'numba._helperlib' from '/home/kc611/anaconda3/envs/aesara/lib/python3.8/site-packages/numba/_helperlib.cpython-38-x86_64-linux-gnu.so'>)

Why are these methods inaccessible from the lowered interface ?

The full code is at: https://gist.github.com/kc611/821b41413d0f6cc0ad34d842a25aa7ea

1 Like