Previously, when no value for layers_to_save was passed to register_activation_hooks, it would register all named modules. This was problematic because not all modules output a tensor, and so an AttributeError would be thrown.
This update provides a default value for layers_to_save, and also uses a try, except block in save_activations_statistics.
Also, I've switched the output of register_activation_hooks from being a dictionary of lists to a dictionary of dictionaries such that all of the statistics are labeled now.