Beispiel #1
0
 def forward(self, x, reverse=False):
     if reverse:
         x = grad_reverse(x, self.lambd)
     x = F.relu(self.bn2_fc(self.fc2(x)))
     x = F.dropout(x, training=self.training)
     x = self.fc3(x)
     return x
 def forward(self, x_feat, reverse=False):
     x = self.relu(self.bn1_fc(self.fc1(x_feat)))
     x = F.dropout(x, training=self.training)
     if reverse:
         x = grad_reverse(x, self.lambd)
     x = self.relu(self.bn2_fc(self.fc2(x)))
     output = self.fc3(x)
     return output, x
    def forward(self, x, reverse=False):
        x = self.model.avgpool(self.model.features(x))
        x_feat = x.view(x.size(0), 256 * 6 * 6)

        x = self.relu(self.bn1_fc(self.fc1(x_feat)))
        x = F.dropout(x, training=self.training)
        if reverse:
            x = grad_reverse(x, self.lambd)
        x = self.relu(self.bn2_fc(self.fc2(x)))
        return x, x_feat
    def forward(self, x, reverse=False):  # GOOD x_feat PLACE ??? IMPORTANT!!!
        x = self.mp1(self.relu(self.bn1(self.conv1(x))))
        x = self.mp2(self.relu(self.bn2(self.conv2(x))))
        x = self.mp3(self.relu(self.bn3(self.conv3(x))))
        x = self.mp4(self.relu(self.bn4(self.conv4(x))))

        x_feat = x.view(x.size(0), 128 * 8 * 8)
        x = self.relu(self.bn1_fc(self.fc1(x_feat)))
        x = F.dropout(x, training=self.training)
        if reverse:
            x = grad_reverse(x, self.lambd)
        x = self.relu(self.bn2_fc(self.fc2(x)))
        return x, x_feat
 def forward(self, x, reverse=False):
     #print(x.shape)
     x = self.pool(F.relu(self.bn1(self.conv1(x))))
     #print(x.shape)
     x = self.pool(F.relu(self.bn2(self.conv2(x))))
     #print(x.shape)
     x = F.relu(self.bn3(self.conv3(x)))
     #print(x.shape)
     x = x.view(x.size(0), 64896)
     #x = x.view(x.size(0),864)
     x = F.relu(self.bn1_fc(self.fc1(x)))
     x = F.dropout(x, training=self.training)
     if reverse:
         x = grad_reverse(x, self.lambd)
     x = F.relu(self.bn2_fc(self.fc2(x)))
     return x
Beispiel #6
0
 def forward(self, x, reverse=False):
     x = F.max_pool2d(F.relu(self.bn1(self.conv1(x))),
                      stride=2,
                      kernel_size=3,
                      padding=1)
     x = F.max_pool2d(F.relu(self.bn2(self.conv2(x))),
                      stride=2,
                      kernel_size=3,
                      padding=1)
     x = F.relu(self.bn3(self.conv3(x)))
     x_feat = x.view(x.size(0), 8192)
     x = F.relu(self.bn1_fc(self.fc1(x_feat)))
     x = F.dropout(x, training=self.training)
     if reverse:
         x = grad_reverse(x, self.lambd)
     x = F.relu(self.bn2_fc(self.fc2(x)))
     return x, x_feat
Beispiel #7
0
 def forward(self, x, reverse=False):
     if reverse:
         x = grad_reverse(x, self.lambd)
     # x = F.relu(self.bn2_fc(self.fc2(x)))
     x = self.fc3(x)
     return x