If you are working with a binary classification task, you should pass a single value:
criterion = nn.BCEWithLogitsLoss(pos_weight=torch.tensor(5.))
x = torch.randn(10, 1)
y = torch.randint(0, 2, (10, 1)).float()

loss = criterion(x, y)