Skip to content

Instantly share code, notes, and snippets.

@AlessandroMondin
Last active December 7, 2022 09:36
Show Gist options
  • Save AlessandroMondin/fee23034ecd3bebbdb660a4cf706a0ad to your computer and use it in GitHub Desktop.
Save AlessandroMondin/fee23034ecd3bebbdb660a4cf706a0ad to your computer and use it in GitHub Desktop.
class CBL(nn.Module):
def __init__(self, in_channels, out_channels, kernel_size, stride, padding):
super(CBL, self).__init__()
conv = nn.Conv2d(in_channels, out_channels, kernel_size, stride, padding, bias=False)
bn = nn.BatchNorm2d(out_channels, eps=1e-3, momentum=0.03)
self.cbl = nn.Sequential(
conv,
bn,
# https://pytorch.org/docs/stable/generated/torch.nn.SiLU.html
nn.SiLU(inplace=True)
)
def forward(self, x):
return self.cbl(x)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment