| 9 | from torchinfo import summary |
| 10 | |
| 11 | class CNNBlock(torch.nn.Module): |
| 12 | def __init__(self,in_channels,out_channels,stride=2): |
| 13 | super(CNNBlock, self).__init__() |
| 14 | self.conv = torch.nn.Sequential( |
| 15 | torch.nn.Conv2d(in_channels=in_channels,out_channels=out_channels,kernel_size=(4,4), |
| 16 | stride=(stride,stride ),bias=False,padding_mode='reflect'), |
| 17 | torch.nn.BatchNorm2d(num_features=out_channels), |
| 18 | torch.nn.LeakyReLU(negative_slope=0.2) |
| 19 | ) |
| 20 | def forward(self,input): |
| 21 | x = self.conv(input) |
| 22 | return x |
| 23 | |
| 24 | |
| 25 | class Discriminator(torch.nn.Module): |