Skip to content

Commit

Permalink
Use LeakyRelu from nn
Browse files Browse the repository at this point in the history
  • Loading branch information
mohitzsh committed Nov 23, 2017
1 parent ad8307a commit 4c36202
Showing 1 changed file with 11 additions and 7 deletions.
18 changes: 11 additions & 7 deletions discriminators/discriminator.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,21 +13,25 @@ def __init__(self,in_channels,negative_slope = 0.2):
self._negative_slope = negative_slope

self.conv1 = nn.Conv2d(in_channels=self._in_channels,out_channels=64,kernel_size=4,stride=2,padding=1)

self.relu1 = nn.LeakyReLU(self._negative_slope)
self.conv2 = nn.Conv2d(in_channels=64,out_channels=128,kernel_size=4,stride=2,padding=1)

self.relu2 = nn.LeakyReLU(self._negative_slope)
self.conv3 = nn.Conv2d(in_channels=128,out_channels=256,kernel_size=4,stride=2,padding=1)

self.relu3 = nn.LeakyReLU(self._negative_slope)
self.conv4 = nn.Conv2d(in_channels=256,out_channels=512,kernel_size=4,stride=2,padding=1)
self.relu4 = nn.LeakyReLU(self._negative_slope)

self.conv5 = nn.Conv2d(in_channels=512,out_channels=1,kernel_size=4,stride=2,padding=1)

def forward(self,x):
x= F.LeakyReLU(self.conv1(x),self._negative_slope) # -,-,161,161
x= F.LeakyReLU(self.conv2(x),self._negative_slope) # -,-,81,81
x= F.LeakyReLU(self.conv3(x),self._negative_slope) # -,-,41,41
x= F.LeakyReLU(self.conv4(x),self._negative_slope) # -,-,21,21
x= self.conv1(x) # -,-,161,161
x = self.relu1(x)
x= self.conv2(x) # -,-,81,81
x = self.relu2(x)
x= self.conv3(x) # -,-,41,41
x = self.relu3(x)
x= self.conv4(x) # -,-,21,21
x = self.relu4(x)
x = self.conv5(x) # -,-,11,11

# upsample
Expand Down

0 comments on commit 4c36202

Please sign in to comment.