Esempio n. 1
0
 def f(pred):
     assert python_should_be_running
     checkify.check(pred, "foo")
Esempio n. 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)
Esempio n. 3
0
 def body(carry, x):
     checkify.check(jnp.all(x > 0), "should be positive")
     return carry, x
Esempio n. 4
0
 def f():
     checkify.check(False, "hi")
Esempio n. 5
0
 def f(x):
     checkify.check(x > 0, "must be positive!")
     return jnp.log(x)
Esempio n. 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
Esempio n. 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
Esempio n. 8
0
 def f(x):
     checkify.check(jnp.sum(x) == 1., "x must sum to one.")
     return x
Esempio n. 9
0
 def while_body(val):
     i, x = val
     checkify.check(x < 0, "x must be negative")
     return i + 1., x + 1
Esempio n. 10
0
 def while_cond(val):
     i, _ = val
     checkify.check(i < 0, "i must be negative")
     return i < 2