split out unseqout

This commit is contained in:
Mike J Innes 2017-02-27 23:05:19 +00:00
parent 8f911cc31e
commit 7af64398d5

View File

@ -122,18 +122,20 @@ function unroll(model, n)
Unrolled(model, graph, state, true, n) Unrolled(model, graph, state, true, n)
end end
function unseqinput(v::IVertex) function unseqin(v::IVertex)
prewalk(v) do v prewalk(v) do v
# TODO: inputidx function # TODO: inputidx function
isa(value(v), Split) && DataFlow.isinput(v[1]) && value(v[1]).n == 2 ? v[1] : v isa(value(v), Split) && DataFlow.isinput(v[1]) && value(v[1]).n == 2 ? v[1] : v
end end
end end
unseqout(v::IVertex) = group(v[1], map(x->x[1], inputs(v)[2:end])...)
unseq(graph) = unseqout(unseqin(graph))
function unroll1(model) function unroll1(model)
graph, state = unrollgraph(model, 1) graph, state = unrollgraph(model, 1)
graph = unseqinput(graph) Unrolled(model, unseq(graph), state, false, 1)
graph = group(graph[1], map(x->x[1], inputs(graph)[2:end])...)
Unrolled(model, graph, state, false, 1)
end end
flip(model) = Capacitor(map(x -> x isa Offset ? -x : x, atomise(model))) flip(model) = Capacitor(map(x -> x isa Offset ? -x : x, atomise(model)))