When i define weight in BCELoss I got this error. How to resolve it? I have 2 classes.
criterion=nn.BCELoss(weight=torch.FloatTensor([2.0, 1.0]))
RuntimeError: The size of tensor a (1447) must match the size of tensor b (2) at non-singleton dimension 0