Dropout pytorch GAN

Hi everyone!

I’ve been trying to add dropout in my discriminator network. But somehow, I keep getting invalid syntax error in my console and I have no idea why. For instance, when I add

nn.Dropout(0.8)

after any LeakyRelu, I get this error:

nn.Conv1d(64, 128, 4, 2, 1, bias=False),
^
SyntaxError: invalid syntax

Here is my discriminator:

class Discriminator(nn.Module):
def init(self, ngpu):
super(Discriminator, self).init()
self.ngpu = ngpu
self.main = nn.Sequential(
# input is (1 x 1 x 4096)
nn.Conv1d(1, 32, 4, 2, 1, bias=False),
nn.LeakyReLU(0.2, inplace=True),
# state size. (1 x 32 x 2048)
nn.Conv1d(32, 64, 4, 2, 1, bias=False),
nn.BatchNorm1d(64),
nn.LeakyReLU(0.2, inplace=True)
# state size. (1 x 64 x 1024)
nn.Conv1d(64, 128, 4, 2, 1, bias=False),
nn.BatchNorm1d(128),
nn.LeakyReLU(0.2, inplace=True),
# state size. (1 x 128 x 512)
nn.Conv1d(128, 256, 4, 2, 1, bias=False),
nn.BatchNorm1d(256),
nn.LeakyReLU(0.2, inplace=True),
# state size. (1 x 256 x 256)
nn.Conv1d(256, 1, 256, 1, 0, bias=False),
nn.Sigmoid()
# state size. (1 x 1 x 1)
)
def forward(self, input):
return self.main(input)

My apologies… I am soo noob. I forgot to add a comma after the dropout!!!
I’ve been dealing with this error for 2 entire days lol.