-
-
Notifications
You must be signed in to change notification settings - Fork 144
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
eqx.error_if errors even when predicate is false if input array is empty #835
Comments
Another issue seems to be The following fixes things for my purposes:
|
Whoop, needed a small addition :)
|
This is intentional. The array is needed to place the error-check in the right place in the right place in the program. I think special-casing static def allen_error_if(x, pred, msg):
if type(pred) is not bool and type(jax.core.get_aval(pred)) is jax.core.ConcreteArray:
with jax.ensure_compile_time_eval():
pred = pred.item()
if pred is False:
return x
else:
return eqx.error_if(x, pred, msg) Note that your code above has a bug in that it does not return anything, so the error-check will be DCE'd. |
Hm, it seems like it would be generally helpful for |
Re-visiting this, I think there was a mis-understanding. The issue is not
|
Hello!
The following currently errors out:
with the error:
This is the line of code where the error happens:
I'm wondering if there's some way around this in the case that
pred=False
?The text was updated successfully, but these errors were encountered: