You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hi, I have a question that I can not fix for a long time. The hierarchy of the project is:
jaxtest
src
* main.py
* test.py
in the main.py, I write a closure:
def outfunc(criterion):
criterion = criterion + 1 # do something
def newfunc(a, b):
if criterion % 2 == 0: # condition
return a
else:
return b
return jit(newfunc)
and in the test.py
func = outfunc(np.array(2))
print(func(0, 1))
What I want to is when calling outfunc, I need to pass some args, and those args determine the behavior of newfunc. If there is an if condition statement in the jitted function, we must indicate args as static_argnums or names. But if I write like this, return jit(newfunc, static_argnames='criterion') still, ConcretizationTypeError raises.
Thanks in advance if someone can help me with this.
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
Uh oh!
There was an error while loading. Please reload this page.
-
Hi, I have a question that I can not fix for a long time. The hierarchy of the project is:
in the main.py, I write a closure:
and in the test.py
What I want to is when calling
outfunc
, I need to pass some args, and those args determine the behavior ofnewfunc
. If there is anif
condition statement in the jitted function, we must indicate args asstatic_argnums or names
. But if I write like this,return jit(newfunc, static_argnames='criterion')
still, ConcretizationTypeError raises.Thanks in advance if someone can help me with this.
Beta Was this translation helpful? Give feedback.
All reactions