I’m using BCEWithLogitsLoss while my batch size is 24 and one single node output.
I’m defining the loss as
weight = torch.FloatTensor([1.0, .25])
criterion =nn.BCEWithLogitsLoss(weight=weight )

So I’m having this error
RuntimeError: The size of tensor a (24) must match the size of tensor b (2) at non-singleton dimension 0
Do I need to re-initiate the weight in each call for the loss with an arranged weight of the batch size?