I am a running a classification program. While I am running this code I am getting this error:
TypeError
---> 19 = GaborNN().to(device)
/opt/conda/lib/python3.6/site-packages/GaborNet/GaborLayer.py in __init__(self, in_channels, out_channels, kernel_size, stride, padding, dilation, groups, bias, padding_mode)
33 groups,
34 bias,
---> 35 padding_mode,
36 )
37 self.kernel_size = self.conv_layer.kernel_size
TypeError: __init__() takes from 4 to 9 positional arguments but 10 were given
where as my code is this:
class GaborNN(nn.Module):
def __init__(self):
super(GaborNN, self).__init__()
self.g0 = GaborConv2d(in_channels=1, out_channels=96, kernel_size=(11,11))
self.c1 = nn.Conv2d(96, 384, (3,3))
self.fc1 = nn.Linear(384*3*3, 64)
self.fc2 = nn.Linear(64, 7)
def forward(self, x):
x = F.leaky_relu(self.g0(x))
x = nn.MaxPool2d()(x)
x = F.leaky_relu(self.c1(x))
x = nn.MaxPool2d()(x)
x = x.view(-1, 384*3*3)
x = F.leaky_relu(self.fc1(x))
x = self.fc2(x)
return x
model = GaborNN().to(device)
please let me know where it is going wrong.
source https://stackoverflow.com/questions/72764474/typeerror-init-takes-from-4-to-9-positional-arguments-but-10-were-given
Comments
Post a Comment