class_docstr: Drop-in replacement for nn.BCEWithLogitsLoss with few additions:
  - Support of ignore_index value
  - Support of label smoothing
code: def forward(self, input: Tensor, target: Tensor) -> Tensor:
      if self.smooth_factor is not None:
          soft_targets = (
              (1 - target) * self.smooth_factor
              + target * (1 - self.smooth_factor)
          ).type_as(input)
      else:
          soft_targets = target.type_as(input)
  
      loss = F.binary_cross_entropy_with_logits(
          input,
          soft_targets,
          self.weight,
          pos_weight=self.pos_weight,
          reduction="none",
      )
  
      if self.ignore_index is not None:
          not_ignored_mask: Tensor = target != self.ignore_index
          loss *= not_ignored_mask.type_as(loss)
  
      if self.reduction == "mean":
          loss = loss.mean()
  
      if self.reduction == "sum":
          loss = loss.sum()
  
      return loss
  
imports: from typing import Optional
  import torch.nn.functional
  from torch import nn, Tensor
label_desc: Use image node_id 2 for calling the SoftBCEWithLogitsLoss obj's underlying member method code with example usage: obj.forward(input, target) and returns: loss