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

Method __init__

beginner_source/dcgan_faces_tutorial.py:406–428  ·  view source on GitHub ↗
(self, ngpu)

Source from the content-addressed store, hash-verified

404
405class Discriminator(nn.Module):
406 def __init__(self, ngpu):
407 super(Discriminator, self).__init__()
408 self.ngpu = ngpu
409 self.main = nn.Sequential(
410 # input is ``(nc) x 64 x 64``
411 nn.Conv2d(nc, ndf, 4, 2, 1, bias=False),
412 nn.LeakyReLU(0.2, inplace=True),
413 # state size. ``(ndf) x 32 x 32``
414 nn.Conv2d(ndf, ndf * 2, 4, 2, 1, bias=False),
415 nn.BatchNorm2d(ndf * 2),
416 nn.LeakyReLU(0.2, inplace=True),
417 # state size. ``(ndf*2) x 16 x 16``
418 nn.Conv2d(ndf * 2, ndf * 4, 4, 2, 1, bias=False),
419 nn.BatchNorm2d(ndf * 4),
420 nn.LeakyReLU(0.2, inplace=True),
421 # state size. ``(ndf*4) x 8 x 8``
422 nn.Conv2d(ndf * 4, ndf * 8, 4, 2, 1, bias=False),
423 nn.BatchNorm2d(ndf * 8),
424 nn.LeakyReLU(0.2, inplace=True),
425 # state size. ``(ndf*8) x 4 x 4``
426 nn.Conv2d(ndf * 8, 1, 4, 1, 0, bias=False),
427 nn.Sigmoid()
428 )
429
430 def forward(self, input):
431 return self.main(input)

Callers

nothing calls this directly

Calls 1

__init__Method · 0.45

Tested by

no test coverage detected