Понимание Adde rNet модель строительного кодирования - PullRequest
0 голосов
/ 18 апреля 2020

Какова цель следующего фрагмента кода в Adde rNet?

def _make_layer(self, block, planes, blocks, stride=1):
    downsample = None
    if stride != 1 or self.inplanes != planes * block.expansion:
        downsample = nn.Sequential(
            adder.adder2d(self.inplanes, planes * block.expansion, kernel_size=1, stride=stride, bias=False),
            nn.BatchNorm2d(planes * block.expansion)
        )

    layers = []
    layers.append(block(inplanes = self.inplanes, planes = planes, stride = stride, downsample = downsample))
    self.inplanes = planes * block.expansion
    for _ in range(1, blocks):
        layers.append(block(inplanes = self.inplanes, planes = planes))

    return nn.Sequential(*layers)
...