Solved by manny in post #3 
              
              
                Thanks for the reply @MariosOreo 
I’m not sure if ptblck’s suggestion was to do what I did, but this seemed to work: 
I checked the shape of my label tensor, and it was (1,2,512,512) 
So in order to match the pos_weight vector’s shape to the label’s shape, I did the following: 
pw = torch.FloatTenso…