From 86c129e5293ff2acf56b4172e5ba281509f0d731 Mon Sep 17 00:00:00 2001 From: Johnson yue Date: Fri, 30 Apr 2021 11:08:51 +0800 Subject: [PATCH] Update discriminator.py More general for any image size --- models/discriminator.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/models/discriminator.py b/models/discriminator.py index d89db19..d874218 100644 --- a/models/discriminator.py +++ b/models/discriminator.py @@ -26,9 +26,9 @@ def __init__(self, image_size=256, num_domains=2, max_conv_dim=1024): blocks += [ActFirstResBlk(dim_in, dim_in, downsample=False)] blocks += [ActFirstResBlk(dim_in, dim_out, downsample=True)] dim_in = dim_out - + last_kernel = int(image_size / 2**repeat_num) blocks += [nn.LeakyReLU(0.2)] - blocks += [nn.Conv2d(dim_out, dim_out, 5, 1, 0)] + blocks += [nn.Conv2d(dim_out, dim_out, last_kernel, 1, 0)] blocks += [nn.LeakyReLU(0.2)] blocks += [nn.Conv2d(dim_out, num_domains, 1, 1, 0)] self.main = nn.Sequential(*blocks)