(self, block, planes, blocks, stride=1, dilate=False)
| 170 | nn.init.constant_(m.bn2.weight, 0) |
| 171 | |
| 172 | def _make_layer(self, block, planes, blocks, stride=1, dilate=False): |
| 173 | norm_layer = self._norm_layer |
| 174 | downsample = None |
| 175 | previous_dilation = self.dilation |
| 176 | if dilate: |
| 177 | self.dilation *= stride |
| 178 | stride = 1 |
| 179 | if stride != 1 or self.inplanes != planes * block.expansion: |
| 180 | downsample = nn.Sequential( |
| 181 | conv1x1(self.inplanes, planes * block.expansion, stride), |
| 182 | norm_layer(planes * block.expansion), |
| 183 | ) |
| 184 | |
| 185 | layers = [] |
| 186 | layers.append(block(self.inplanes, planes, stride, downsample, self.groups, |
| 187 | self.base_width, previous_dilation, norm_layer)) |
| 188 | self.inplanes = planes * block.expansion |
| 189 | for _ in range(1, blocks): |
| 190 | layers.append(block(self.inplanes, planes, groups=self.groups, |
| 191 | base_width=self.base_width, dilation=self.dilation, |
| 192 | norm_layer=norm_layer)) |
| 193 | |
| 194 | return nn.Sequential(*layers) |
| 195 | |
| 196 | def _forward_impl(self, x): |
| 197 | # See note [TorchScript super()] |
no test coverage detected