Last active
August 23, 2019 14:15
-
-
Save lasseha/be03f33a75ddbb44dfb10c063364b6fe to your computer and use it in GitHub Desktop.
conv upsampling
This file contains hidden or 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 ConvUpsampling(nn.Module): | |
| def __init__(self, in_channels, out_channels, kernel_size, stride=1, padding=0): | |
| super(ConvUpsampling, self).__init__() | |
| self.scale_factor = kernel_size | |
| self.conv = nn.Sequential( | |
| nn.Conv2d(in_channels, out_channels, kernel_size, stride, padding, bias=False), | |
| nn.BatchNorm2d(out_channels), | |
| nn.LeakyReLU() | |
| ) | |
| def forward(self, x): | |
| x = F.interpolate(x, scale_factor=self.scale_factor, mode='bilinear') | |
| return self.conv(x) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment