MCPcopy Create free account
hub / github.com/thygate/stable-diffusion-webui-depthmap-script / __init__

Method __init__

inpaint/networks.py:431–459  ·  view source on GitHub ↗
(self, use_sigmoid=True, use_spectral_norm=True, init_weights=True, in_channels=None)

Source from the content-addressed store, hash-verified

429
430class Discriminator(BaseNetwork):
431 def __init__(self, use_sigmoid=True, use_spectral_norm=True, init_weights=True, in_channels=None):
432 super(Discriminator, self).__init__()
433 self.use_sigmoid = use_sigmoid
434 self.conv1 = self.features = nn.Sequential(
435 spectral_norm(nn.Conv2d(in_channels=in_channels, out_channels=64, kernel_size=4, stride=2, padding=1, bias=not use_spectral_norm), use_spectral_norm),
436 nn.LeakyReLU(0.2, inplace=True),
437 )
438
439 self.conv2 = nn.Sequential(
440 spectral_norm(nn.Conv2d(in_channels=64, out_channels=128, kernel_size=4, stride=2, padding=1, bias=not use_spectral_norm), use_spectral_norm),
441 nn.LeakyReLU(0.2, inplace=True),
442 )
443
444 self.conv3 = nn.Sequential(
445 spectral_norm(nn.Conv2d(in_channels=128, out_channels=256, kernel_size=4, stride=2, padding=1, bias=not use_spectral_norm), use_spectral_norm),
446 nn.LeakyReLU(0.2, inplace=True),
447 )
448
449 self.conv4 = nn.Sequential(
450 spectral_norm(nn.Conv2d(in_channels=256, out_channels=512, kernel_size=4, stride=1, padding=1, bias=not use_spectral_norm), use_spectral_norm),
451 nn.LeakyReLU(0.2, inplace=True),
452 )
453
454 self.conv5 = nn.Sequential(
455 spectral_norm(nn.Conv2d(in_channels=512, out_channels=1, kernel_size=4, stride=1, padding=1, bias=not use_spectral_norm), use_spectral_norm),
456 )
457
458 if init_weights:
459 self.init_weights()
460
461 def forward(self, x):
462 conv1 = self.conv1(x)

Callers

nothing calls this directly

Calls 3

spectral_normFunction · 0.85
__init__Method · 0.45
init_weightsMethod · 0.45

Tested by

no test coverage detected