Hi,
My simple CNN is as follows:
lass CNN(nn.Module):
def __init__(self):
super(CNN, self).__init__()
self.conv1 = nn.Conv2d(3, 6, 5)
self.conv2 = nn.Conv2d(6, 10, 5)
#self.conv2_drop = nn.Dropout2d()
self.fc1 = nn.Linear(446520, 50)
self.fc2 = nn.Linear(50, 3)
def forward(self, x):
x = F.relu(F.max_pool2d(self.conv1(x), 2))
x = F.relu(F.max_pool2d(self.conv2(x), 2))
x = x.view(-1, 446520)
x = F.relu(self.fc1(x))
x = self.fc2(x)
return x
And I compute output as follows:
output = model.forward(data)
Here, data
's dimension is 3 * 3 * height * weight. My label is a list of three elements. So output
should be 3 * 3 (batch size = 3). But in this case, output
is 1 * 3. I am not getting what’s wrong. I tried changing the batch size (i.e 4), still it returns 1 *3 matrix,