A deep learning library for spiking neural networks which is based on PyTorch, focuses on fast training and supports inference on neuromorphic hardware.
fron line # 256 to line # 259. The input argument "monitor_layers" is used as below:
monitor_chip_layers = [self.find_chip_layer(lyr) for lyr in monitor_layers if lyr != "dvs"]
if "dvs" in monitor_layers:
monitor_chip_layers.append("dvs")
config_builder.monitor_layers(config, monitor_chip_layers)
But when the method "self.find_chip_layer(lyr)" executed, the string "dvs" is eliminated, but self.chip_layers_ordering still contains the "dvs" string. So it will return the wrong layer index in the
self.find_chip_layer(lyr).
Solution
Modify the function
def find_chip_layer(self, layer_idx):
"""
Given an index of a layer in the model, find the corresponding chip layer where it is placed
Parameters
----------
layer_idx: int
Index of a layer
Returns
-------
chip_lyr_idx: int
Index of the layer on the chip where the model layer is placed.
"""
if len(self.chip_layers_ordering) != len(self.compatible_layers):
raise Exception("Looks like the model has not been mapped onto a device.")
return self.chip_layers_ordering[layer_idx]
as
def find_chip_layer(self, layer_idx):
"""
Given an index of a layer in the model, find the corresponding chip layer where it is placed
Parameters
----------
layer_idx: int
Index of a layer
Returns
-------
chip_lyr_idx: int
Index of the layer on the chip where the model layer is placed.
"""
if len(self.chip_layers_ordering) != len(self.compatible_layers):
raise Exception("Looks like the model has not been mapped onto a device.")
chip_layers = self.chip_layers_ordering.copy()
if "dvs" in self.chip_layers_ordering:
# solve the idx mismatch if "dvs" in self.chip_layers_ordering
chip_layers.remove("dvs")
return chip_layers[layer_idx]
Description
e.g. if I call the DynapcnnCompatibleNetwork.make_config() as below:
fron line # 256 to line # 259. The input argument "monitor_layers" is used as below:
But when the method "self.find_chip_layer(lyr)" executed, the string "dvs" is eliminated, but self.chip_layers_ordering still contains the "dvs" string. So it will return the wrong layer index in the self.find_chip_layer(lyr).
Solution
Modify the function
as