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?