code
stringlengths
3
6.57k
x2.size()
F.pad(x1[:, :, :, :], (0, 0, 0, 0, ch_diff//2, ch_diff//2)
F.pad(x1[:, :, :, :], (0, 0, 0, 0, ch_diff//2, (ch_diff//2)
F.pad(x2[:, :, :, :], (0, 0, 0, 0, ch_diff//2, ch_diff//2)
F.pad(x2[:, :, :, :], (0, 0, 0, 0, ch_diff//2, (ch_diff//2)
conv3x3(in_planes, out_planes, stride=1, groups=1, dilation=1)
conv1x1(in_planes, out_planes, stride=1)
nn.Conv2d(in_planes, out_planes, kernel_size=1, stride=stride, bias=False)
BasicBlock(nn.Module)
super(BasicBlock, self)
__init__()
ValueError("BasicBlock only supports groups=1 and base_width=64")
NotImplementedError("Dilation > 1 not supported in BasicBlock")
conv3x3(n_in_channels, n_channels1, stride)
norm_layer(n_channels1)
nn.ReLU(inplace=True)
conv3x3(n_channels1, n_channels2)
norm_layer(n_channels2)
downsample(n_in_channels, n_channels3)
forward(self, x)
self.conv1(x)
self.bn1(out)
self.relu(out)
self.conv2(out)
self.bn2(out)
self.downsample(x)
zero_padding(out, identity)
self.relu(out)
ResNet34(nn.Module)
super(ResNet34, self)
__init__()
len(replace_stride_with_dilation)
format(replace_stride_with_dilation)
nn.Conv2d(3, ch_conv1, kernel_size=7, stride=2, padding=3, bias=False)
norm_layer(ch_conv1)
nn.ReLU(inplace=True)
nn.MaxPool2d(kernel_size=3, stride=2, padding=1)
max(ch_conv1, ch_l10_2)
max(in_ch_l11, ch_l11_2)
max(in_ch_l12, ch_l12_2)
max(ch_l20_ds, ch_l20_2)
max(in_ch_l21, ch_l21_2)
max(in_ch_l22, ch_l22_2)
max(in_ch_l23, ch_l23_2)
max(ch_l30_ds, ch_l30_2)
max(in_ch_l31, ch_l31_2)
max(in_ch_l32, ch_l32_2)
max(in_ch_l33, ch_l33_2)
max(in_ch_l34, ch_l34_2)
max(in_ch_l35, ch_l35_2)
max(ch_l40_ds, ch_l40_2)
max(in_ch_l41, ch_l41_2)
max(in_ch_l42, ch_l42_2)
nn.AdaptiveAvgPool2d((1, 1)
nn.Linear(in_ch_fc, num_classes)
self.modules()
isinstance(m, nn.Conv2d)
nn.init.kaiming_normal_(m.weight, mode="fan_out", nonlinearity="relu")
isinstance(m, (nn.BatchNorm2d, nn.GroupNorm)
nn.init.constant_(m.weight, 1)
nn.init.constant_(m.bias, 0)
self.modules()
isinstance(m, Bottleneck)
nn.init.constant_(m.bn3.weight, 0)
isinstance(m, BasicBlock)
nn.init.constant_(m.bn2.weight, 0)
nn.Sequential( conv1x1(n_in_channels0, n_channels_ds, stride)
norm_layer(n_channels_ds)
nn.Sequential(*layers)
nn.Sequential( conv1x1(n_in_channels0, n_channels_ds, stride)
norm_layer(n_channels_ds)
nn.Sequential(*layers)
nn.Sequential( conv1x1(n_in_channels0, n_channels_ds, stride)
norm_layer(n_channels_ds)
nn.Sequential(*layers)
forward(self, x)
self.conv1(x)
self.bn1(x)
self.relu(x)
self.maxpool(x)
self.layer1(x)
self.layer2(x)
self.layer3(x)
self.layer4(x)
self.avgpool(x)
x.reshape(x.size(0)
self.fc(x)
AllegationsDownloadTestCase(SimpleTestCase)
patch('allegation.services.download_allegations.xlsxwriter.Workbook')
test_write_disclaimer(self, mock_workbook)
Setting.objects.first()
SettingFactory()
DownloadFactory()
format(line_1=line_1, line_2=line_2)
setting.save()
MagicMock()
mock_workbook()
patch('allegation.services.download_allegations.os')
AllegationsDownload(download.id)
allegation_download.init_workbook()