Created
December 7, 2022 10:22
-
-
Save AlessandroMondin/d32e366f9d3f77a8c2c8fae24824e13f 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 Bottleneck(nn.Module): | |
""" | |
Parameters: | |
in_channels (int): number of channel of the input tensor | |
out_channels (int): number of channel of the output tensor | |
width_multiple (float): it controls the number of channels (and weights) | |
of all the convolutions beside the | |
first and last one. If closer to 0, | |
the simpler the modelIf closer to 1, | |
the model becomes more complex | |
""" | |
def __init__(self, in_channels, out_channels, width_multiple=1): | |
super(Bottleneck, self).__init__() | |
c_ = int(width_multiple*in_channels) | |
self.c1 = CBL(in_channels, c_, kernel_size=1, stride=1, padding=0) | |
self.c2 = CBL(c_, out_channels, kernel_size=3, stride=1, padding=1) | |
def forward(self, x): | |
return self.c2(self.c1(x)) + x |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment