MCPcopy Create free account
hub / github.com/NVIDIA/semantic-segmentation / _make_one_branch

Method _make_one_branch

network/hrnetv2.py:147–170  ·  view source on GitHub ↗
(self, branch_index, block, num_blocks, num_channels,
                         stride=1)

Source from the content-addressed store, hash-verified

145 raise ValueError(error_msg)
146
147 def _make_one_branch(self, branch_index, block, num_blocks, num_channels,
148 stride=1):
149 downsample = None
150 if stride != 1 or \
151 self.num_inchannels[branch_index] != (num_channels[branch_index] *
152 block.expansion):
153 downsample = nn.Sequential(
154 nn.Conv2d(self.num_inchannels[branch_index],
155 num_channels[branch_index] * block.expansion,
156 kernel_size=1, stride=stride, bias=False),
157 Norm2d(num_channels[branch_index] * block.expansion,
158 momentum=BN_MOMENTUM),
159 )
160
161 layers = []
162 layers.append(block(self.num_inchannels[branch_index],
163 num_channels[branch_index], stride, downsample))
164 self.num_inchannels[branch_index] = \
165 num_channels[branch_index] * block.expansion
166 for i in range(1, num_blocks[branch_index]):
167 layers.append(block(self.num_inchannels[branch_index],
168 num_channels[branch_index]))
169
170 return nn.Sequential(*layers)
171
172 def _make_branches(self, num_branches, block, num_blocks, num_channels):
173 branches = []

Callers 1

_make_branchesMethod · 0.95

Calls 1

Norm2dFunction · 0.90

Tested by

no test coverage detected