Using hook functions to call on a custom function to modify a layer given parameters of another layer

Hi all,

I’m slightly struggling with implementing a hook function within my SNN. I’m looking to call on a function at every epoch which modifies a layer’s voltages (in this example), layer[3] given another layer’s voltages and weights, layer[0]

The custom function unfolds the tensors in an array and does some computation there. layer[3]'s dimension will also be changed.

I am looking to call the hook function to do something like the following:

hook_handle = net.register_forward_hook(custom_function(net.layer[0], net.layer[3]))

Looking for a little guidance here as I am quite new to hook functions.

I don’t fully understand why forward hooks are used, but I assume you are using the forward activation for the actual manipulation?
It also seems you want to directly manipulate the weight attribute of a layer based on this computation?
Could you give a small example of the actual manipulation and when the parameter should be changed?