Created
October 27, 2020 10:08
-
-
Save pranjalAI/1602f6036f3a3a9fb8fad4407a5feaef to your computer and use it in GitHub Desktop.
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 ResidualSep(nn.Module): | |
def __init__(self, channels, dilation=1): | |
super().__init__() | |
self.blocks = nn.Sequential( | |
nn.ReLU(), | |
nn.ReflectionPad2d(dilation), | |
nn.Conv2d(channels, channels, kernel_size=3, stride=1, | |
padding=0, dilation=dilation, | |
groups=channels, bias=False), | |
nn.BatchNorm2d(channels), | |
nn.ReLU(inplace=True), | |
nn.Conv2d(channels, channels, kernel_size=1, stride=1, | |
padding=0, bias=False), | |
nn.BatchNorm2d(channels) | |
) | |
def forward(self, x): | |
return x + self.blocks(x) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment