(self, inplanes, planes, stride=1, downsample=None,
radix=1, cardinality=1, bottleneck_width=64,
avd=False, avd_first=False, dilation=1, is_first=False,
rectified_conv=False, rectify_avg=False,
norm_layer=None, dropblock_prob=0.0, last_gamma=False)
| 100 | expansion = 4 |
| 101 | |
| 102 | def __init__(self, inplanes, planes, stride=1, downsample=None, |
| 103 | radix=1, cardinality=1, bottleneck_width=64, |
| 104 | avd=False, avd_first=False, dilation=1, is_first=False, |
| 105 | rectified_conv=False, rectify_avg=False, |
| 106 | norm_layer=None, dropblock_prob=0.0, last_gamma=False): |
| 107 | super(Bottleneck, self).__init__() |
| 108 | group_width = int(planes * (bottleneck_width / 64.)) * cardinality |
| 109 | self.conv1 = nn.Conv2d(inplanes, group_width, kernel_size=1, bias=False) |
| 110 | self.bn1 = norm_layer(group_width) |
| 111 | self.dropblock_prob = dropblock_prob |
| 112 | self.radix = radix |
| 113 | self.avd = avd and (stride > 1 or is_first) |
| 114 | self.avd_first = avd_first |
| 115 | |
| 116 | if self.avd: |
| 117 | self.avd_layer = nn.AvgPool2d(3, stride, padding=1) |
| 118 | stride = 1 |
| 119 | |
| 120 | if dropblock_prob > 0.0: |
| 121 | self.dropblock1 = DropBlock2D(dropblock_prob, 3) |
| 122 | if radix == 1: |
| 123 | self.dropblock2 = DropBlock2D(dropblock_prob, 3) |
| 124 | self.dropblock3 = DropBlock2D(dropblock_prob, 3) |
| 125 | |
| 126 | if radix > 1: |
| 127 | self.conv2 = SplAtConv2d( |
| 128 | group_width, group_width, kernel_size=3, |
| 129 | stride=stride, padding=dilation, |
| 130 | dilation=dilation, groups=cardinality, bias=False, |
| 131 | radix=radix, rectify=rectified_conv, |
| 132 | rectify_avg=rectify_avg, |
| 133 | norm_layer=norm_layer, |
| 134 | dropblock_prob=dropblock_prob) |
| 135 | elif rectified_conv: |
| 136 | from rfconv import RFConv2d |
| 137 | self.conv2 = RFConv2d( |
| 138 | group_width, group_width, kernel_size=3, stride=stride, |
| 139 | padding=dilation, dilation=dilation, |
| 140 | groups=cardinality, bias=False, |
| 141 | average_mode=rectify_avg) |
| 142 | self.bn2 = norm_layer(group_width) |
| 143 | else: |
| 144 | self.conv2 = nn.Conv2d( |
| 145 | group_width, group_width, kernel_size=3, stride=stride, |
| 146 | padding=dilation, dilation=dilation, |
| 147 | groups=cardinality, bias=False) |
| 148 | self.bn2 = norm_layer(group_width) |
| 149 | |
| 150 | self.conv3 = nn.Conv2d( |
| 151 | group_width, planes * 4, kernel_size=1, bias=False) |
| 152 | self.bn3 = norm_layer(planes*4) |
| 153 | |
| 154 | if last_gamma: |
| 155 | from torch.nn.init import zeros_ |
| 156 | zeros_(self.bn3.weight) |
| 157 | self.relu = nn.ReLU(inplace=True) |
| 158 | self.downsample = downsample |
| 159 | self.dilation = dilation |
nothing calls this directly
no test coverage detected