Indexing argument function passed to bakward hooks

Is there a way to pass an index with the function given as the parameter of the backward hook. That is I would like not to make a separate statement for every layer

 self.activation1.register_backward_hook(self._func1)
 self.activation2.register_backward_hook(self._func2)
 self.activation3.register_backward_hook(self._func3)
 self.activation4.register_backward_hook(self._func4)
etc.

I can make an array of self.activation[i]. But is there way also to do it with the argument function to the backward hook?

do you mean something like this,

def func(name):
  def hook(module, grad_input, grad_output):
    # hook implementation
  return hook
for name, layer in model.named_modules():
  layer.register_backward_hook(func(name))