sonos / tract

Tiny, no-nonsense, self-contained, Tensorflow and ONNX inference
Other
2.24k stars 214 forks source link

Scan to Loop roadmap #1072

Open mathieupoumeyrolsonos opened 1 year ago

mathieupoumeyrolsonos commented 1 year ago

Step 0: Preliminaries

Step 1: Replace Scan by Loop

State management

Processing input

Processing output

Unrolling loops ?

Current choice:

Step 2: flatten subgraphs

mathieupoumeyrolsonos commented 1 year ago

Possible next step:

long term, nnef extension in this spirit of :

graph body_rec(xs) -> ys {

    i = 0
    ys = zeroes[shape(x)]
    c = zeroes[...]

    loop {
        break if i == shape(x)
        x = xs[i];
        ys = assign_slice(ys, i, F(x, c));
        c = C(x, c)
        i = i + 1;
    }

    ys
}