-
Notifications
You must be signed in to change notification settings - Fork 44
Open
Description
In the code given below , I find that we are not specifying weights in the resnet layers. If so do we except that the weights will get updated through the optimizer and not through the HyperNetwork ? -
class ResNetBlock(nn.Module):
def __init__(self, in_size=16, out_size=16, downsample = False):
super(ResNetBlock,self).__init__()
self.out_size = out_size
self.in_size = in_size
if downsample:
self.stride1 = 2
self.reslayer = nn.Conv2d(in_channels=self.in_size, out_channels=self.out_size, stride=2, kernel_size=1)
else:
self.stride1 = 1
self.reslayer = IdentityLayer()
self.bn1 = nn.BatchNorm2d(out_size)
self.bn2 = nn.BatchNorm2d(out_size)
def forward(self, x, conv1_w, conv2_w):
residual = self.reslayer(x)
print(x.shape)
out = F.relu(self.bn1(F.conv2d(x, conv1_w, stride=self.stride1, padding=1)), inplace=True)
out = self.bn2(F.conv2d(out, conv2_w, padding=1))
out += residual
out = F.relu(out)
return out
Metadata
Metadata
Assignees
Labels
No labels