New closure algorithm
Aims
- New closure and memory allocation algorithm
- Redesign type-functions
- Update logging
- Tests update
Closure logic
Before evaluating of a graph we need to close it. The procedure contains important checks, updates of types and shapes and memory allocation.
- Call
Graph.close()
- Loop to determine
dtype
/shape
. Optional: check consistency. Loop over allnodes
of thegraph
. Eachnode
:- Get
input
types. Triggers deep scan. - Check consistency. Derive
output
types.
- Get
- Loop to allocate memory. Loop over all
nodes
of the graph. Eachnode
:- Allocate
inputs
. Each:- Allocates an
input
if it can. - Trigger
input.input
to allocate.
- Allocates an
- Allocate
outputs
. Each:- Check if
output.input
is allocated, use it. - Otherwise: allocate output.
- Trigger
output.input
to set data
- Trigger
- Check if
- Allocate