MCPcopy Create free account
hub / github.com/OpenGVLab/HumanBench / __init__

Method __init__

PATH/core/models/ops/conv2d_helpers.py:86–107  ·  view source on GitHub ↗
(self, in_channels, out_channels, kernel_size=3,
                 stride=1, padding='', split_op='equal', dilated=False, depthwise=False, **kwargs)

Source from the content-addressed store, hash-verified

84 """
85
86 def __init__(self, in_channels, out_channels, kernel_size=3,
87 stride=1, padding='', split_op='equal', dilated=False, depthwise=False, **kwargs):
88 super(MixedConv2d, self).__init__()
89
90 kernel_size = kernel_size if isinstance(kernel_size, list) else [kernel_size]
91 num_groups = len(kernel_size)
92 in_splits = _split_channels(in_channels, num_groups, split_op=split_op)
93 out_splits = _split_channels(out_channels, num_groups, split_op=split_op)
94 for idx, (k, in_ch, out_ch) in enumerate(zip(kernel_size, in_splits, out_splits)):
95 d = 1
96 # FIXME make compat with non-square kernel/dilations/strides
97 if stride == 1 and dilated:
98 d, k = (k - 1) // 2, 3
99 conv_groups = out_ch if depthwise else 1
100 # use add_module to keep key space clean
101 self.add_module(
102 str(idx),
103 conv2d_pad(
104 in_ch, out_ch, k, stride=stride,
105 padding=padding, dilation=d, groups=conv_groups, **kwargs)
106 )
107 self.splits = in_splits
108
109 def forward(self, x):
110 if len(self.splits) > 1:

Callers

nothing calls this directly

Calls 3

_split_channelsFunction · 0.85
conv2d_padFunction · 0.85
__init__Method · 0.45

Tested by

no test coverage detected