-
Notifications
You must be signed in to change notification settings - Fork 2
/
SN_GAN.py
36 lines (29 loc) · 1017 Bytes
/
SN_GAN.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
# coding=utf-8
from SN_YL import SNConv2d
import torch.nn as nn
class Discriminator(nn.Module):
def __init__(self, input_nc, ndf):
super(Discriminator, self).__init__()
self.model = nn.Sequential(
# input is 3 x 256 x 256
#SNConv2d()
SNConv2d(input_nc, ndf, 6, 2, 2),
# nn.InstanceNorm2d(ndf),
nn.ReLU(inplace=True),
SNConv2d(ndf, ndf * 2, 6, 2, 2),
# nn.InstanceNorm2d(ndf * 2),
nn.ReLU(inplace=True),
# state size
SNConv2d(ndf * 2, 256, 3, 1, 1),
# nn.InstanceNorm2d(256),
nn.ReLU(inplace=True),
SNConv2d(256, 512, 3, 1, 1),
# nn.InstanceNorm2d(512),
nn.ReLU(inplace=True),
# state size output: 1 * 64 * 64
SNConv2d(512, 1, 3, 1, 1),
nn.Sigmoid()
)
def forward(self, x):
output = self.model(x)
return output