pos_weight is currently implemented in nn.BCEWithLogitsLoss 36, so you would have to either reimplement BCELoss with these weight arguments or switch to BCEWithLogitsLoss.
I would recommend to second approach, as it will also have more numerical stability.