def __init__()

in segmentation/model/cnsn_resnet.py [0:0]


    def __init__(self, inplanes, planes, pos, cn_pos, beta, crop, cnsn_type, stride=1, downsample=None, groups=1,
                 base_width=64, dilation=1, norm_layer=None, custom=False):
        super(BottleneckCustom, self).__init__()
        if norm_layer is None:
            norm_layer = nn.BatchNorm2d
        width = int(planes * (base_width / 64.)) * groups
        # Both self.conv2 and self.downsample layers downsample the input when stride != 1
        self.conv1 = conv1x1(inplanes, width)
        self.bn1 = norm_layer(width)
        self.conv2 = conv3x3(width, width, stride, groups, dilation)
        self.bn2 = norm_layer(width)
        self.conv3 = conv1x1(width, planes * self.expansion)
        self.bn3 = norm_layer(planes * self.expansion)
        self.relu = nn.ReLU(inplace=True)
        self.downsample = downsample
        self.stride = stride
        self.custom = custom
        
        if self.custom:
            assert cnsn_type in ['sn', 'cn', 'cnsn']

            if 'cn' in cnsn_type and cn_pos is None:
                crossnorm = CrossNorm(crop=crop, beta=beta)
            else:
                crossnorm = None

            if 'sn' in cnsn_type:
                print('using SelfNorm module')
                if pos == 'pre' and self.downsample is None:
                    selfnorm = SelfNorm(in_planes)
                else:
                    selfnorm = SelfNorm(planes * self.expansion)
            else:
                selfnorm = None

            # if using selfnorm and crossnorm at the same time, then use them at the same location
            # separating their positions is not supported currently.
            self.cnsn = CNSN(selfnorm=selfnorm, crossnorm=crossnorm)
            if 'cn' in cnsn_type and cn_pos is not None:
                self.real_cn = CrossNorm(beta=beta, crop=crop)
            self.cn_pos = cn_pos


            self.pos = pos
            if pos is not None:
                print('{} in residual module: {}'.format(cnsn_type, pos))
                assert pos in ['residual', 'identity', 'pre', 'post']