-
-
Save Sivaram46/2910f145f315b7120f2707bd72decd42 to your computer and use it in GitHub Desktop.
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 Dense_Layer(nn.Module): | |
def __init__(self, in_channels, growthrate, bn_size): | |
super(Dense_Layer, self).__init__() | |
self.bn1 = nn.BatchNorm2d(in_channels) | |
self.conv1 = nn.Conv2d( | |
in_channels, bn_size * growthrate, kernel_size=1, bias=False | |
) | |
self.bn2 = nn.BatchNorm2d(bn_size * growthrate) | |
self.conv2 = nn.Conv2d( | |
bn_size * growthrate, growthrate, kernel_size=3, padding=1, bias=False | |
) | |
def forward(self, prev_features): | |
out1 = torch.cat(prev_features, dim=1) | |
out1 = self.conv1(F.relu(self.bn1(out1))) | |
out2 = self.conv2(F.relu(self.bn2(out1))) | |
return out2 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment