-
Hi, I was wondering if it's possible to convert a while loop using lax.foriloop or lax.while_loop, where the loop guard is of the form: step = 0
while .1 * step <= 10.:
# Do something
step += 1 I understand how the foriloop works, but the documentation looks to require and int for the lower and upper and also seems to satisfy such loop guards as |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment
-
Actually, this problem can be solved using a lax.while_loop. The solution looks something like the following: def body(carry):
# Do something
return carry + 1
cond_fun = lambda carry: .1 * carry <= 10.
lax.while_loop(cond_fun, body, 0) |
Beta Was this translation helpful? Give feedback.
Actually, this problem can be solved using a lax.while_loop. The solution looks something like the following: