mapping#
This module contains methods to map a given network to the chip.
- class sinabs.backend.dynapcnn.mapping.Edge(s: int, t: int, cap: int, flow: int = 0, rev: ForwardRef('Edge') | None = None)[source]#
- Parameters:
s (int)
t (int)
cap (int)
flow (int)
rev (Edge | None)
- class sinabs.backend.dynapcnn.mapping.LayerConstraints(kernel_memory: int, neuron_memory: int, bias_memory: int)[source]#
- Parameters:
kernel_memory (int)
neuron_memory (int)
bias_memory (int)
- sinabs.backend.dynapcnn.mapping.find_chip_layers(layer: DynapcnnLayer, constraints: List[LayerConstraints]) List[int] [source]#
Find all layers where a given layer configuration fits.
- Parameters:
layer (DynapcnnLayer) – DynapcnnLayer
constraints (List[LayerConstraints]) – A list of all the layer’s constraints
- Return type:
A list of indices of layers where the given layer fits.
- sinabs.backend.dynapcnn.mapping.get_valid_mapping(model: DynapcnnNetwork, constraints: List[LayerConstraints]) List[Tuple[int, int]] [source]#
Given a model, find a valid layer ordering for its placement within the constraints provided.
- Parameters:
model (DynapcnnNetwork) – DynapcnnNetwork
constraints (List[LayerConstraints]) – A list of all the layer’s constraints
- Return type:
List[Tuple[int, int]]
- sinabs.backend.dynapcnn.mapping.make_flow_graph(layer_mapping: List[List[int]], num_layers: int = 9) List[List[Edge]] [source]#
Make a flow graph given all possible chip layers for each DynapcnnCompatibleLayer layer. Note that the flows are not computed yet. The flow for the graph generated here needs to be populated by calling the method edmonds
- Parameters:
layer_mapping (List[List[int]]) – List of a list of all layer indices. Eg. [[1,3], [4, 6, 1]] for a two layer model
num_layers (int) – Number of layers on the chip
- Returns:
graph
- Return type:
List[List[Edge]]