Created
March 26, 2021 08:22
-
-
Save udithhaputhanthri/258a41ea53336278fc1dc7901eae4576 to your computer and use it in GitHub Desktop.
WGAN_scripts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class conv_trans_block(nn.Module): | |
def __init__(self,in_channels,out_channels,kernal_size=4,stride=2,padding=1): | |
super(conv_trans_block,self).__init__() | |
self.block=nn.Sequential( | |
nn.ConvTranspose2d(in_channels,out_channels,kernal_size,stride,padding), | |
nn.BatchNorm2d(out_channels), | |
nn.ReLU()) | |
def forward(self,x): | |
return self.block(x) | |
class conv_block(nn.Module): | |
def __init__(self,in_channels,out_channels,kernal_size=4,stride=2,padding=1): | |
super(conv_block,self).__init__() | |
self.block=nn.Sequential( | |
nn.Conv2d(in_channels,out_channels,kernal_size,stride,padding), | |
nn.BatchNorm2d(out_channels), | |
nn.LeakyReLU(0.2)) | |
def forward(self,x): | |
return self.block(x) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment