@ptrblck This is the model using pretained AlexNet. I just tried to reimplement the network in this figure:
Deep Domain Confusion 1
class AlexNetFc(nn.Module):

    def __init__(self, pretrained=False, num_classes=1000):
        super(AlexNetFc, self).__init__()
        model_alexnet = alexnet(pretrained=pretrained)
        self.features = model_alexnet.features
        self.classifier = nn.Sequential()
        for i in range(6):
            self.classifier.add_module("classifier" + str(i), model_alexnet.classifier[i])
        self.__in_features = model_alexnet.classifier[6].in_features
        self.nfc = nn.Linear(4096, num_classes)

    def forward(self, x, y):
        x = self.features(x)
        y = self.features(y)
        dist = distance_function(x,y)
        x = x.view(x.size(0), 256 * 6 * 6)
        x = self.classifier(x)
        x = self.nfc(x)
        y = y.view(x.size(0), 256 * 6 * 6)
        y = self.classifier(y)
        y = self.nfc(y)
        return x,y,dist

    def output_num(self):
        return self.__in_features

    def distance_function(x,y):
        return some distance such as Euclidean distance