I have created some general purpose optimization functions using njit that work great … except for one annoying warning I’m getting when I run them inside another njit function:
NumbaExperimentalFeatureWarning: First-class function type feature is experimental
warnings.warn("First-class function type feature is experimental",
I totally understand why this is happening but I don’t know how to get rid of it. I’ve tried searching this group but I fear I just might not know the right terminology to use for an effective search.
The call to my optimization function looks something like this:
lower, middle, upper = glob_min_nb(
criter_func,
params,
ivar,
-3.0, # low
3.0, # high
15, # npts (number of points to try)
False, # log_space
0,
*criter_func_args
)
I know the problem is with the glob_min_nb function type signature (or lack thereof).
The parameters criter_func and criter_func_args are going to be dynamic based on the optimization problem being solved and therefore, I cannot strictly type glob_min_nb at time of njit decoration.
Question:
Is there anyway within code to apply the static signatures of criter_func and criter_func_args (as well as the other parameters in the above function call) and dynamically create a function signature which I can apply to glob_min_nb at compile/run time?
Thanks in advance for any help!