Skip to main content

fori_loop

Function fori_loop 

Source
pub fn fori_loop<B: Backend, C: Tree<B>>(
    lo: impl Into<I32<B>>,
    hi: impl Into<I32<B>>,
    body: impl Fn(I32<B>, C) -> C,
    init: C,
) -> C
Expand description

for i in lo..hi { state = body(i, state) } (lax.fori_loop). The bounds are Rust integers or values. On Trace, as in JAX, this is a scan when both bounds are static, and a while otherwise.