Exemple #1
0
 def forward(self, x):
     out = F.relu(self.bn1(self.conv1(x)))
     out = self.layers(out)
     out = F.avg_pool2d(out, 2)
     out = out.view(out.size(0), -1)
     out = self.linear(out)
     return out
Exemple #2
0
 def forward(self, x):
     out = F.relu(self.bn1(self.conv1(x)))
     out = self.layers(out)
     out = F.relu(self.bn2(self.conv2(out)))
     # NOTE: change pooling kernel_size 7 -> 4 for CIFAR10
     out = F.avg_pool2d(out, 4)
     out = out.view(out.size(0), -1)
     out = self.linear(out)
     return out
Exemple #3
0
 def forward(self, x):
     out = self.conv1(x)
     out = self.layer1(out)
     out = self.layer2(out)
     out = self.layer3(out)
     out = self.layer4(out)
     out = F.avg_pool2d(out, 4)
     out = out.view(out.size(0), -1)
     out = self.linear(out)
     return out
Exemple #4
0
 def forward(self, x):
     out = F.relu(self.bn1(self.conv1(x)))
     out = self.layer1(out)
     out = self.layer2(out)
     out = self.layer3(out)
     out = self.layer4(out)
     out = self.layer5(out)
     out = F.avg_pool2d(out, 8)
     out = self.linear(out.view(out.size(0), -1))
     return out
Exemple #5
0
 def forward(self, x):
     out = F.relu(self.bn1(self.conv1(x)))
     # out = F.max_pool2d(out, 3, stride=2, padding=1)
     out = self.layer1(out)
     out = self.layer2(out)
     out = self.layer3(out)
     out = F.relu(self.bn2(self.conv2(out)))
     out = F.avg_pool2d(out, 4)
     out = out.view(out.size(0), -1)
     out = self.linear(out)
     return out
Exemple #6
0
    def forward(self, x):
        out = self.conv1(x)
        print(out.shape)
        out = self.trans1(self.dense1(out))
        print(out.shape)
        out = self.trans2(self.dense2(out))
        out = self.trans3(self.dense3(out))
        out = self.dense4(out)
        out = F.avg_pool2d(F.relu(self.bn(out)), 4)
        out = out.view(out.size(0), -1)

        out = self.linear(out)
        return out
Exemple #7
0
    def forward(self, x):
        out = F.relu(self.bn1(self.conv1(x)))
        out = self.bn2(self.conv2(out))

        # Squeeze
        w = F.avg_pool2d(out, out.size(2))
        w = F.relu(self.fc1(w))
        w = F.sigmoid(self.fc2(w))
        # Excitation
        out = out * w  # New broadcasting feature from v0.2!

        out += self.shortcut(x)
        out = F.relu(out)
        return out
Exemple #8
0
    def forward(self, x):
        out = F.relu(self.bn1(x))
        shortcut = self.shortcut(out) if hasattr(self, 'shortcut') else x
        out = self.conv1(out)
        out = self.conv2(F.relu(self.bn2(out)))

        # Squeeze
        w = F.avg_pool2d(out, out.size(2))
        w = F.relu(self.fc1(w))
        w = F.sigmoid(self.fc2(w))
        # Excitation
        out = out * w

        out += shortcut
        return out
Exemple #9
0
 def forward(self, x):
     out = self.conv(F.relu(self.bn(x)))
     print(out.shape)
     out = F.avg_pool2d(out, 2)
     print(out.shape)
     return out