Skip to content

Instantly share code, notes, and snippets.

@johnolafenwa
Created April 26, 2018 21:06
Show Gist options
  • Save johnolafenwa/820490088098ca3d37983001df05685b to your computer and use it in GitHub Desktop.
Save johnolafenwa/820490088098ca3d37983001df05685b to your computer and use it in GitHub Desktop.
class Unit(nn.Module):
def __init__(self, in_channels, out_channels):
super(Unit, self).__init__()
self.conv = nn.Conv2d(in_channels=in_channels, kernel_size=3, out_channels=out_channels, stride=1, padding=1)
self.bn = nn.BatchNorm2d(num_features=out_channels)
self.relu = nn.ReLU()
def forward(self, input):
output = self.conv(input)
output = self.bn(output)
output = self.relu(output)
return output
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment