MCPcopy Create free account
hub / github.com/thygate/stable-diffusion-webui-depthmap-script / _make_layer

Method _make_layer

lib/Resnext_torch.py:172–194  ·  view source on GitHub ↗
(self, block, planes, blocks, stride=1, dilate=False)

Source from the content-addressed store, hash-verified

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()]

Callers 1

__init__Method · 0.95

Calls 3

conv1x1Function · 0.85
norm_layerFunction · 0.85
appendMethod · 0.80

Tested by

no test coverage detected