I have the following 2 Sequential blocks:
net = Sequential(
nn.Conv2d(1, self.complexity, 4, 2, 3),
nn.LeakyReLU(0.2, inplace=True),
nn.Conv2d(self.complexity, self.complexity * 2, 4, 2, 1),
nn.BatchNorm2d(self.complexity * 2),
nn.LeakyReLU(0.2, inplace=True),
nn.Conv2d(self.complexity * 2, self.complexity * 4, 4, 2, 1),
nn.BatchNorm2d(self.complexity * 4),
nn.LeakyReLU(0.2, inplace=True),
)
and the output of the above network is passed into
classification_layer = Sequential(nn.Conv2d(self.complexity * 4, 11, 4, 1, 0))
where self.complexity is 128.
When I combine the two into one Sequential block by doing the following:
net = Sequential(
nn.Conv2d(1, self.complexity, 4, 2, 3),
nn.LeakyReLU(0.2, inplace=True),
nn.Conv2d(self.complexity, self.complexity * 2, 4, 2, 1),
nn.BatchNorm2d(self.complexity * 2),
nn.LeakyReLU(0.2, inplace=True),
nn.Conv2d(self.complexity * 2, self.complexity * 4, 4, 2, 1),
nn.BatchNorm2d(self.complexity * 4),
nn.LeakyReLU(0.2, inplace=True),
nn.Conv2d(self.complexity * 4, 11, 4, 1, 0)
),
my network behaves differently. I am using these to train a DCGAN on the MNIST dataset for semi-supervised learning. In the first case, I do:
output = classification_layer(net(input))
and I get high accuracies (~90%) whereas in the second case, I do:
output = net(input)
and get lower accuracies (~60%).
Any idea as to why this could be happening? Is my assumption that these two are the same models correct?
I would greatly appreciate any help!