MCPcopy Create free account
hub / github.com/pytorch/examples / _make_layer

Method _make_layer

distributed/rpc/pipeline/main.py:56–75  ·  view source on GitHub ↗
(self, planes, blocks, stride=1)

Source from the content-addressed store, hash-verified

54 self.base_width = width_per_group
55
56 def _make_layer(self, planes, blocks, stride=1):
57 norm_layer = self._norm_layer
58 downsample = None
59 previous_dilation = self.dilation
60 if stride != 1 or self.inplanes != planes * self._block.expansion:
61 downsample = nn.Sequential(
62 conv1x1(self.inplanes, planes * self._block.expansion, stride),
63 norm_layer(planes * self._block.expansion),
64 )
65
66 layers = []
67 layers.append(self._block(self.inplanes, planes, stride, downsample, self.groups,
68 self.base_width, previous_dilation, norm_layer))
69 self.inplanes = planes * self._block.expansion
70 for _ in range(1, blocks):
71 layers.append(self._block(self.inplanes, planes, groups=self.groups,
72 base_width=self.base_width, dilation=self.dilation,
73 norm_layer=norm_layer))
74
75 return nn.Sequential(*layers)
76
77 def parameter_rrefs(self):
78 r"""

Callers 2

__init__Method · 0.80
__init__Method · 0.80

Calls 1

conv1x1Function · 0.85

Tested by

no test coverage detected