Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Accept overloaded functions as parameter #4608

Open
sklam opened this issue Sep 24, 2019 · 0 comments
Open

Accept overloaded functions as parameter #4608

sklam opened this issue Sep 24, 2019 · 0 comments

Comments

@sklam
Copy link
Member

sklam commented Sep 24, 2019

Feature request

Related to #4602

Request: automatically jitting numba supported functions used in arguments for dispatcher.

For example:

In [1]: from numba import njit

In [2]: import numpy as np

In [3]: @njit
   ...: def foo(fn, arr):
   ...:     return fn(arr)
   ...:

In [4]: @njit
   ...: def call_jitted(arr):
   ...:     return foo(np.sum, arr)
   ...:

In [5]: call_jitted(np.ones(4))  # works fine
Out[5]: 4.0

but the below fails:

In [6]: foo(np.sum, np.ones(4))
...
TypingError: Failed in nopython mode pipeline (step: nopython frontend)
non-precise type pyobject
[1] During: typing of argument at <ipython-input-3-3df5be7cc64d> (3)

File "<ipython-input-3-3df5be7cc64d>", line 3:
def foo(fn, arr):
    return fn(arr)
    ^

This issue suggests that the above behavior inconsistency be fixed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants