Solved by ptrblck in post #2 
              
              
                nn.BCEWithLogitsLoss takes a weight and pos_weight argument. 
From the docs: 

weight ( Tensor  , optional ) – a manual rescaling weight given to the loss of each batch element. If given, has to be a Tensor of size nbatch. 
pos_weight ( Tensor  , optional ) – a weight of positive examples. Must be a…