Closed bauerfe closed 7 months ago
One approach to solve the issue about average pooling in synops calculation could be to have a hook that is registered with the network, rather than individual layers. It would probably need some sort of helper hooks that then are registered with the weight layers.
Added the hooks. Still need unit tests and documentation to make sure they work properly.
Unit tests and docstrings are in place now. Also the how-tos about synops have been updated. Still missing: A how to on using the hooks in general, and mentioning the firing rate hook somewhere.
I added a how-to about using custom hooks and included the firing rate in the how-to about snns and synops.
Furthermore I added deprecation warnings to the SNNAnalyzer
and SynOpsCounter
classes.
PR #208 is ready for review
Merged through #208
The
SNNAnalyer
is a useful tool in sinabs to collect various statistics on SNN dynamics. However, it has become somewhat clunky over time and it is hard to collect customized statistics. The approach of hard-coding which data is collected and processed makes theSNNAnalyzer
quite rigid and limits its scope. For instance, it is currently not possible to be used when samples of different batches have different dimensions (e.g. different number of frames).A leaner and more flexible approach might therefore be to provide a range of hooks that can be added to the model. These can be applied selectively and if needed, users can define custom hooks easily. This approach may also reduce memory overhead. Currently the
SNNAnalyzer
stores all input and output data for (almost) all layers in a model. Individual hooks could instead just store the relevant statistics (such as firing rates), which are often more compact.An open question that still needs to be discussed: The
SNNAnalyzer
had a "global" view over a given SNN and was therefore able to take pooling layers into account when calculating synaptic operations. How can this be solved when using hooks that operate on a per-layer level?To do:
SNNAnalyzer
, inlcuding firing rates, and synaptic operationsSNNAnalyzer