MCPcopy Create free account
hub / github.com/CausalLearning/robust-unlearnable-examples / __init__

Method __init__

models/resnet.py:110–123  ·  view source on GitHub ↗
(self, num_blocks, in_dims, out_dims, wide=10)

Source from the content-addressed store, hash-verified

108
109class WRN(nn.Module):
110 def __init__(self, num_blocks, in_dims, out_dims, wide=10):
111 super(WRN, self).__init__()
112 self.in_planes = 16
113 self.wide = wide
114
115 block = BasicBlock
116
117 self.conv1 = nn.Conv2d(in_dims, self.in_planes, kernel_size=3, stride=1, padding=1, bias=False)
118 self.bn1 = nn.BatchNorm2d(16)
119 self.layer1 = self._make_layer(block, 16, num_blocks[0], stride=1)
120 self.layer2 = self._make_layer(block, 32, num_blocks[1], stride=2)
121 self.layer3 = self._make_layer(block, 64, num_blocks[2], stride=2)
122 self.avgpool = nn.AdaptiveAvgPool2d((1,1))
123 self.linear = nn.Linear(64*wide, out_dims)
124
125 def _make_layer(self, block, planes, num_blocks, stride):
126 strides = [stride] + [1]*(num_blocks-1)

Callers 3

__init__Method · 0.45
__init__Method · 0.45
__init__Method · 0.45

Calls 1

_make_layerMethod · 0.95

Tested by

no test coverage detected