Esempio n. 1
0
 def forward(self, x, hparams):
     self.conv1.weight = conv(self.conv1.weight, hparams, self.training)
     out = F.relu(self.bn1(self.conv1(x)))
     self.conv2.weight = conv(self.conv2.weight, hparams, self.training)
     out = self.bn2(self.conv2(out))
     out += self.shortcut(x)
     out = F.relu(out)
     return out
Esempio n. 2
0
 def forward(self, x, hparams):
     self.conv1.weight = conv(self.conv1.weight, hparams, self.training)
     out = F.relu(self.bn1(self.conv1(x)))
     for i in range(len(self.layer1)):
         out = self.layer1[i](out, hparams)
     for i in range(len(self.layer2)):
         out = self.layer2[i](out, hparams)
     for i in range(len(self.layer2)):
         out = self.layer3[i](out, hparams)
     for i in range(len(self.layer2)):
         out = self.layer4[i](out, hparams)
     out = F.avg_pool2d(out, 4)
     out = out.view(out.size(0), -1)
     out = self.linear(out)
     return out