Example #1
0
 def f(pred):
     assert python_should_be_running
     checkify.check(pred, "foo")
Example #2
0
 def f():
     # Note that x is not an argument to the checkified function.
     checkify.check(x > 0, "must be positive!")
     return jnp.log(x)
Example #3
0
 def body(carry, x):
     checkify.check(jnp.all(x > 0), "should be positive")
     return carry, x
Example #4
0
 def f():
     checkify.check(False, "hi")
Example #5
0
 def f(x):
     checkify.check(x > 0, "must be positive!")
     return jnp.log(x)
Example #6
0
 def multi_errors(x):
     checkify.check(jnp.all(x < 0), "must be negative!")  # ASSERT
     x = x / 0  # DIV
     x = jnp.sin(x)  # NAN
     x = x[500]  # OOB
     return x
Example #7
0
 def multi_errors(x):
     x = x / 0  # DIV
     x = jnp.sin(x)  # NAN
     x = x[500]  # OOB
     checkify.check(x < 0, "must be negative!")  # ASSERT
     return x
Example #8
0
 def f(x):
     checkify.check(jnp.sum(x) == 1., "x must sum to one.")
     return x
Example #9
0
 def while_body(val):
     i, x = val
     checkify.check(x < 0, "x must be negative")
     return i + 1., x + 1
Example #10
0
 def while_cond(val):
     i, _ = val
     checkify.check(i < 0, "i must be negative")
     return i < 2