MCPcopy Create free account
hub / github.com/QWTforGithub/T2LDM / downsample_conv

Function downsample_conv

timm/models/resnet.py:430–441  ·  view source on GitHub ↗
(
        in_channels, out_channels, kernel_size, stride=1, dilation=1, first_dilation=None, norm_layer=None)

Source from the content-addressed store, hash-verified

428
429
430def 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
444def downsample_avg(

Callers 1

make_blocksFunction · 0.70

Calls 1

get_paddingFunction · 0.70

Tested by

no test coverage detected