Thank you, for the link to the implementation.
The solution you provided unfortunately doesn’t work as expected.
For example setting the last weight to 1000 like so:
input = torch.rand(1, 3, 2, 2)
target = torch.round(torch.rand(1, 3, 2, 2))

weight = torch.tensor([1., 1., 1000.]).view(1, 3, 1, 1).expand(-1, -1, 2, 2)

criterion = nn.BCEWithLogitsLoss(pos_weight=weight)
loss = criterion(input, target)

doesn’t change the loss at all.