I want to get the pixel-wise BCELoss because some pixels don’t have ground truth. So I want to set the loss of those unlabeled pixels to 0.
But it seems like the current BCELoss function can just provide the sum or average?
class torch.nn.BCELoss(weight=None, size_average=True)
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”.
size_average (bool, optional) – By default, the losses are averaged over observations for each minibatch. However, if the field size_average is set to False, the losses are instead summed for each minibatch. Default: True