MCPcopy Create free account
hub / github.com/pytorch/examples / __init__

Method __init__

dcgan/main.py:170–192  ·  view source on GitHub ↗
(self, ngpu)

Source from the content-addressed store, hash-verified

168
169class Discriminator(nn.Module):
170 def __init__(self, ngpu):
171 super(Discriminator, self).__init__()
172 self.ngpu = ngpu
173 self.main = nn.Sequential(
174 # input is (nc) x 64 x 64
175 nn.Conv2d(nc, ndf, 4, 2, 1, bias=False),
176 nn.LeakyReLU(0.2, inplace=True),
177 # state size. (ndf) x 32 x 32
178 nn.Conv2d(ndf, ndf * 2, 4, 2, 1, bias=False),
179 nn.BatchNorm2d(ndf * 2),
180 nn.LeakyReLU(0.2, inplace=True),
181 # state size. (ndf*2) x 16 x 16
182 nn.Conv2d(ndf * 2, ndf * 4, 4, 2, 1, bias=False),
183 nn.BatchNorm2d(ndf * 4),
184 nn.LeakyReLU(0.2, inplace=True),
185 # state size. (ndf*4) x 8 x 8
186 nn.Conv2d(ndf * 4, ndf * 8, 4, 2, 1, bias=False),
187 nn.BatchNorm2d(ndf * 8),
188 nn.LeakyReLU(0.2, inplace=True),
189 # state size. (ndf*8) x 4 x 4
190 nn.Conv2d(ndf * 8, 1, 4, 1, 0, bias=False),
191 nn.Sigmoid()
192 )
193
194 def forward(self, input):
195 if (input.is_cuda or input.is_xpu) and self.ngpu > 1:

Callers

nothing calls this directly

Calls 1

__init__Method · 0.45

Tested by

no test coverage detected