MCPcopy Create free account
hub / github.com/KeepTryingTo/Pytorch-GAN / Block

Class Block

Code/net/Discriminator.py:12–26  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

10from torchvision import transforms
11
12class Block(torch.nn.Module):
13 def __init__(self,in_channels,out_channels,stride):
14 super(Block, self).__init__()
15 self.in_channels = in_channels
16 self.out_channels = out_channels
17
18 self.conv = torch.nn.Sequential(
19 torch.nn.Conv2d(in_channels=in_channels,out_channels=out_channels,kernel_size=(4,4),
20 stride=stride,padding=1,bias=True,padding_mode='reflect'),
21 torch.nn.BatchNorm2d(num_features=out_channels),
22 torch.nn.LeakyReLU(negative_slope=0.2,inplace=True)
23 )
24 def forward(self,x):
25 out = self.conv(x)
26 return out
27
28class Discriminator(torch.nn.Module):
29 def __init__(self, in_channels=3,features=(64,128,256,512)):

Callers 1

__init__Method · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected