Skip to content

Instantly share code, notes, and snippets.

@udithhaputhanthri
Created March 26, 2021 08:22
Show Gist options
  • Save udithhaputhanthri/258a41ea53336278fc1dc7901eae4576 to your computer and use it in GitHub Desktop.
Save udithhaputhanthri/258a41ea53336278fc1dc7901eae4576 to your computer and use it in GitHub Desktop.
WGAN_scripts
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