Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def __init__(self, inplanes, planes, stride=1, downsample=None, noactivation=False):
super(RevBottleneck, self).__init__()
if downsample is None and stride == 1:
gm = BottleneckSub(inplanes // 2, planes // 2, stride, noactivation)
fm = BottleneckSub(inplanes // 2, planes // 2, stride, noactivation)
self.revblock = ReversibleBlock(gm, fm)
else:
self.bottleneck_sub = BottleneckSub(inplanes, planes, stride, noactivation)
self.downsample = downsample
self.stride = stride
def __init__(self, inplanes, planes, stride=1, downsample=None, noactivation=False):
super(RevBottleneck, self).__init__()
if downsample is None and stride == 1:
gm = BottleneckSub(inplanes // 2, planes // 2, stride, noactivation)
fm = BottleneckSub(inplanes // 2, planes // 2, stride, noactivation)
self.revblock = ReversibleBlock(gm, fm)
else:
self.bottleneck_sub = BottleneckSub(inplanes, planes, stride, noactivation)
self.downsample = downsample
self.stride = stride
def __init__(self, inplanes, planes, stride=1, downsample=None, noactivation=False):
super(RevBottleneck, self).__init__()
if downsample is None and stride == 1:
gm = BottleneckSub(inplanes // 2, planes // 2, stride, noactivation)
fm = BottleneckSub(inplanes // 2, planes // 2, stride, noactivation)
self.revblock = ReversibleBlock(gm, fm)
else:
self.bottleneck_sub = BottleneckSub(inplanes, planes, stride, noactivation)
self.downsample = downsample
self.stride = stride
def __init__(self, inplanes, planes, stride=1, noactivation=False):
super(BottleneckSub, self).__init__()
self.noactivation = noactivation
if not self.noactivation:
self.bn1 = batch_norm(inplanes)
self.conv1 = nn.Conv2d(inplanes, planes, kernel_size=1, bias=False)
self.bn2 = batch_norm(planes)
self.conv2 = nn.Conv2d(planes, planes, kernel_size=3, stride=stride,
padding=1, bias=False)
self.bn3 = batch_norm(planes)
self.conv3 = nn.Conv2d(planes, planes * 4, kernel_size=1, bias=False)
self.relu = nn.ReLU(inplace=True)