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

Class ConvBlock

Code/net/Generator.py:13–24  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

11from torchvision import transforms
12
13class ConvBlock(torch.nn.Module):
14 def __init__(self,in_channels,out_channels,down=True,use_act=True,**kwargs):
15 super(ConvBlock, self).__init__()
16 self.conv = torch.nn.Sequential(
17 torch.nn.Conv2d(in_channels=in_channels,out_channels=out_channels,padding_mode='reflect',**kwargs)
18 if down
19 else torch.nn.ConvTranspose2d(in_channels=in_channels,out_channels=out_channels,**kwargs),
20 torch.nn.BatchNorm2d(num_features=out_channels),
21 torch.nn.ReLU(inplace=True) if use_act else torch.nn.Identity()
22 )
23 def forward(self,x):
24 return self.conv(x)
25
26class ResidualBlock(torch.nn.Module):
27 def __init__(self,channels):

Callers 2

__init__Method · 0.70
__init__Method · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected