Skip to content

Instantly share code, notes, and snippets.

Created June 12, 2021 17:35
What would you like to do?
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 =, 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