Skip to content

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.

  1. Call Graph.close()
  2. Loop to determine dtype/shape. Optional: check consistency. Loop over all nodes of the graph. Each node:
    1. Get input types. Triggers deep scan.
    2. Check consistency. Derive output types.
  3. Loop to allocate memory. Loop over all nodes of the graph. Each node:
    1. Allocate inputs. Each:
      • Allocates an input if it can.
      • Trigger input.input to allocate.
    2. Allocate outputs. Each:
      • Check if output.input is allocated, use it.
      • Otherwise: allocate output.
        • Trigger output.input to set data

Merge request reports