Last active
May 29, 2020 18:08
-
-
Save udithhaputhanthri/ffdff24d68dea70e2a02a73443170e68 to your computer and use it in GitHub Desktop.
Image-to-Image Translation Using Conditional DCGANs
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_block(nn.Module): | |
def __init__(self,in_channels,out_channels,kernel_size=4,stride=2,padding=1): | |
super(conv_block,self).__init__() | |
self.conv_block=nn.Sequential( | |
nn.Conv2d(in_channels,out_channels,kernel_size,stride,padding), | |
nn.LeakyReLU(0.2), | |
nn.BatchNorm2d(out_channels) | |
) | |
def forward(self,x): | |
return self.conv_block(x) | |
class transconv_block(nn.Module): | |
def __init__(self,in_channels,out_channels,kernel_size=4,stride=2,padding=1): | |
super(transconv_block,self).__init__() | |
self.transconv_block=nn.Sequential( | |
nn.ConvTranspose2d(in_channels,out_channels,kernel_size,stride,padding), | |
nn.ReLU(), | |
nn.BatchNorm2d(out_channels) | |
) | |
def forward(self,x): | |
return self.transconv_block(x) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment