Skip to content

Commit

Permalink
WIP - SW forward with DVS
Browse files Browse the repository at this point in the history
added some missing return type hints
  • Loading branch information
Willian-Girao committed Oct 30, 2024
1 parent 7b37885 commit c9e5e70
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions sinabs/backend/dynapcnn/dynapcnnnetwork_module.py
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,7 @@ def get_exit_points(self):
return exit_layers


def setup_dynapcnnlayer_graph(self, index_layers_topologically: bool = False):
def setup_dynapcnnlayer_graph(self, index_layers_topologically: bool = False) -> None:
""" Set up data structures to run forward pass through dynapcnn layers
Parameters
Expand All @@ -157,6 +157,11 @@ def setup_dynapcnnlayer_graph(self, index_layers_topologically: bool = False):
if index_layers_topologically:
self.reindex_layers(self._sorted_nodes)

print('self._dynapcnnlayer_edges: ', self._dynapcnnlayer_edges)
print('self._sorted_nodes: ', self._sorted_nodes)
for key, val in self._node_source_map.items():
print(key, val)

def get_dynapcnnlayers_edges(self) -> Set[Edge]:
"""Create edges representing connections between `DynapcnnLayer` instances.
Expand All @@ -174,7 +179,7 @@ def get_dynapcnnlayers_edges(self) -> Set[Edge]:

return dcnnl_edges

def add_entry_points_edges(self, dcnnl_edges: Set[Edge]):
def add_entry_points_edges(self, dcnnl_edges: Set[Edge]) -> None:
"""Add extra edges `('input', X)` to `dcnnl_edges` for
layers which are entry points of the `DynapcnnNetwork`, i.e.
`handler.entry_node = True`.
Expand Down Expand Up @@ -311,7 +316,7 @@ def forward(
# If there is output from multiple layers return all of them in a dict
return network_outputs

def reindex_layers(self, index_order: List[int]):
def reindex_layers(self, index_order: List[int]) -> None:
""" Reindex layers based on provided order
Will assign new index to dynapcnn layers and update all internal
Expand Down

0 comments on commit c9e5e70

Please sign in to comment.