private
bottleneck
— function
bottleneck(inplanes, outplanes, downsample = false; stride = [1, (downsample ? 2 : 1), 1])
Create a bottleneck residual block
(reference). The bottleneck is composed of
3 convolutional layers each with the given stride
.
By default, stride
implements “ResNet v1.5”
which uses stride == [1, 2, 1]
when downsample == true
.
This version is standard across various ML frameworks.
The original paper uses stride == [2, 1, 1]
when downsample == true
instead.
Arguments:
inplanes
: the number of input feature mapsoutplanes
: a list of the number of output feature maps for each convolution within the residual blockdownsample
: set totrue
to downsample the inputstride
: a list of the stride of the 3 convolutional layers