Skip to content
Discussion options

You must be logged in to vote

You should use & instead of and:

def loop_cond(args):
  return (args[0] < 1000) & (args[1] < 1e6)

The reason is that Python's and eagerly casts its inputs to boolean, and this behavior cannot be overloaded. Thus JAX follows NumPy in using bitwise logical operators, &, |, etc. for doing element-wise logic on boolean arrays.

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@mberaha
Comment options

Answer selected by mberaha
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants