To many parameters given to function in forward_hook when defined inside class

I registered some forward_hooks to my model like that:

The get_layer3-Function gave me the results I wanted.

But I thought it’s cleaner when I register the hook inside my model class:

class Net(nn.Module):
	def __init__(self, vgg):
		super(Net, self).__init__()
		self.features = vgg.features
		self.classifier = nn.Sequential(
			nn.Conv1d(960, 4096, 1),
			nn.Conv1d(4096, 4096, 1),
			nn.Conv1d(4096, 3, 1)

	def forward(self, x):
	def get_layer3(self, input, output):
		output_layer3 =

But now I get this error:
TypeError: get_layer3() takes 3 positional arguments but 4 were given

When I remove the paramter self from the function get_layer3 so it looks like this:

	def get_layer3(input, output):
		output_layer3 =

I get the error:
TypeError: get_layer3() takes 3 positional arguments but 2 were given

So the self-parameter contains somehow to parameters when it’s defined inside my class and one parameter, when is defined outside my class.

Can someone tell me how I can find out why this is so?