Skip to content

Commit

Permalink
feat: fix G padding for even kernels
Browse files Browse the repository at this point in the history
  • Loading branch information
santi-pdp committed Oct 18, 2018
1 parent c061048 commit e5a2c2a
Showing 1 changed file with 2 additions and 4 deletions.
6 changes: 2 additions & 4 deletions segan/models/generator.py
Original file line number Diff line number Diff line change
Expand Up @@ -208,11 +208,9 @@ def forward(self, x, att_weight=0.):
mode=self.linterp_mode)
x = self.linterp_aff(x)
if self.enc and self.padding == 0:
if self.pooling == 1:
# apply proper padding
if self.pooling == 1 and self.kwidth % 2 != 0:
x = F.pad(x, ((self.kwidth//2), self.kwidth//2))
else:
# apply proper padding
x = F.pad(x, ((self.kwidth//2)-1, self.kwidth//2))

h = self.conv(x)
Expand Down Expand Up @@ -518,7 +516,7 @@ def __init__(self, ninputs, enc_fmaps, kwidth,
fmaps, dec_kwidth, act,
lnorm=lnorm,
dropout=dropout, pooling=1,
padding=kwidth//2,
padding=0,#kwidth//2,
enc=True,
bias=bias,
convblock=convblock))
Expand Down

0 comments on commit e5a2c2a

Please sign in to comment.