Hello, I’m trying to implement a pre-trained InceptionV3 model but I keep getting this error:
ValueError: Target size (torch.Size([15])) must be the same as input size (torch.Size([15, 1]))

I’m using BCEWithLogitsLoss and I’m pretty sure this had to do with self.fc = nn.Linear(2048, num_classes). I have a batch of 15 and the outputs should return 15 classifications.
Why is it adding the [1] and how can I remove that?
This is my training code:
for batch_idx, (inputs, targets, filename) in enumerate(trainloader):
        if USE_CUDA:
            inputs = inputs.cuda()
            targets = torch.FloatTensor(np.array(targets).astype(float)).cuda()

        

        optimizer.zero_grad()
        inputs, targets = Variable(inputs), Variable(targets)
        outputs = net(inputs)
        _, preds = torch.max(outputs, 1)
        loss = criterion(outputs, targets)