I am trying to create a Binary Classifier for dogs and cats. Here is the model of the network:
ConvNet(
(conv1): Conv2d(3, 32, kernel_size=(7, 7), stride=(1, 1))
(max_pool): MaxPool2d(kernel_size=3, stride=3, padding=0, dilation=1, ceil_mode=False)
(conv2): Conv2d(32, 64, kernel_size=(3, 3), stride=(1, 1))
(avg_pool): AvgPool2d(kernel_size=2, stride=2, padding=0)
(fc1): Linear(in_features=131072, out_features=100, bias=True)
(fc2): Linear(in_features=100, out_features=1, bias=True)
)
This is the code I use to train the network:
loss = nn.BCELoss()
optimizer = optim.RMSprop(net.parameters(), lr=0.001)
for epoch in range(2):
    running_loss = 0.0
    correct = 0
    net.train()
    for data, target in training_set:
        target = target.float()
        optimizer.zero_grad()
        output = net(data)
        loss = loss(output, target)
        loss.backward()
        optimizer.step()
        running_loss += loss.item()

I am getting this error when calling the line > loss = loss(output, target)
... in binary_cross_entropy
    raise ValueError("Target and input must have the same number of elements. target nelement ({}) "
ValueError: Target and input must have the same number of elements. target nelement (32) != input nelement (1)

From what I understand the output of my network is 1 but the labels of the dataset are 32 because of the batch size.