(self, branch_index, block, num_blocks, num_channels,
stride=1)
| 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 = [] |
no test coverage detected