From a0b63ee7f4a8c793c0d200c86ef07677aa4cbf2e Mon Sep 17 00:00:00 2001 From: Volpeon Date: Thu, 13 Apr 2023 07:14:24 +0200 Subject: Update --- models/convnext/discriminator.py | 8 +------- models/sparse.py | 2 +- 2 files changed, 2 insertions(+), 8 deletions(-) (limited to 'models') diff --git a/models/convnext/discriminator.py b/models/convnext/discriminator.py index 7dbbe3a..571b915 100644 --- a/models/convnext/discriminator.py +++ b/models/convnext/discriminator.py @@ -15,13 +15,7 @@ class ConvNeXtDiscriminator(): self.img_std = torch.tensor(IMAGENET_DEFAULT_STD).view(1, -1, 1, 1) def get_score(self, img): - img_mean = self.img_mean.to(device=img.device, dtype=img.dtype) - img_std = self.img_std.to(device=img.device, dtype=img.dtype) - - img = ((img+1.)/2.).sub(img_mean).div(img_std) - - img = F.interpolate(img, size=(self.input_size, self.input_size), mode='bicubic', align_corners=True) - pred = self.net(img) + pred = self.get_all(img) return torch.softmax(pred, dim=-1)[:, 1] def get_all(self, img): diff --git a/models/sparse.py b/models/sparse.py index bcb2897..07b3413 100644 --- a/models/sparse.py +++ b/models/sparse.py @@ -15,7 +15,7 @@ class PseudoSparseEmbedding(nn.Module): if dropout_p > 0.0: self.dropout = nn.Dropout(p=dropout_p) else: - self.dropout = lambda x: x + self.dropout = nn.Identity() self.register_buffer('mapping', torch.zeros(0, device=device, dtype=torch.long)) -- cgit v1.2.3-70-g09d2