(
in_channels, out_channels, kernel_size, stride=1, dilation=1, first_dilation=None, norm_layer=None)
| 428 | |
| 429 | |
| 430 | def downsample_conv( |
| 431 | in_channels, out_channels, kernel_size, stride=1, dilation=1, first_dilation=None, norm_layer=None): |
| 432 | norm_layer = norm_layer or nn.BatchNorm2d |
| 433 | kernel_size = 1 if stride == 1 and dilation == 1 else kernel_size |
| 434 | first_dilation = (first_dilation or dilation) if kernel_size > 1 else 1 |
| 435 | p = get_padding(kernel_size, stride, first_dilation) |
| 436 | |
| 437 | return nn.Sequential(*[ |
| 438 | nn.Conv2d( |
| 439 | in_channels, out_channels, kernel_size, stride=stride, padding=p, dilation=first_dilation, bias=False), |
| 440 | norm_layer(out_channels) |
| 441 | ]) |
| 442 | |
| 443 | |
| 444 | def downsample_avg( |
no test coverage detected