class_docstr: Implements the Region Mutual Information(RMI) Loss（https://arxiv.org/abs/1910.12037） for Semantic Segmentation.
  Unlike vanilla rmi loss which contains Cross Entropy Loss, we disband them and only
  left the RMI-related parts.
  The motivation is to allow for a more flexible combination of losses during training.
  For example, by employing mixed loss to merge RMI Loss with Boostrap Cross Entropy Loss,
  we can achieve the online mining of hard examples together with attention to region information.
  Args:
      weight (tuple|list|ndarray|Tensor, optional): A manual rescaling weight
          given to each class. Its length must be equal to the number of classes.
          Default ``None``.
      ignore_index (int64, optional): Specifies a target value that is ignored
          and does not contribute to the input gradient. Default ``255``.
docstr: Using the sigmiod operation both.
  Args:
          logits_4D   :   [N, C, H, W], dtype=float32
          labels_4D   :   [N, H, W], dtype=long
          do_rmi          :       bool
docstr_tok: ["Using","the","sigmiod","operation","both",".","Args",":","logits_4D",":","[","N",",","C",",","H",",","W","]",",","dtype=float32","labels_4D",":","[","N",",","H",",","W","]",",","dtype=long","do_rmi",":","bool"]
code: def forward_sigmoid(self, logits_4D, labels_4D, do_rmi=False):
      """
      Using the sigmiod operation both.
      Args:
              logits_4D   :   [N, C, H, W], dtype=float32
              labels_4D   :   [N, H, W], dtype=long
              do_rmi          :       bool
      """
      label_mask_3D = labels_4D != self.ignore_index
      valid_onehot_labels_4D = paddle.cast(
          F.one_hot(
              paddle.cast(labels_4D, dtype="int64")
              * paddle.cast(label_mask_3D, dtype="int64"),
              num_classes=self.num_classes,
          ),
          dtype="float32",
      )
      # label_mask_flat = paddle.cast(
      #     paddle.reshape(label_mask_3D, [-1]), dtype='float32')
  
      valid_onehot_labels_4D = (
          valid_onehot_labels_4D
          * paddle.unsqueeze(label_mask_3D, axis=3)
      )
      valid_onehot_labels_4D.stop_gradient = True
      probs_4D = (
          F.sigmoid(logits_4D) * paddle.unsqueeze(label_mask_3D, axis=1)
          + _CLIP_MIN
      )
  
      valid_onehot_labels_4D = paddle.transpose(
          valid_onehot_labels_4D, [0, 3, 1, 2]
      )
      valid_onehot_labels_4D.stop_gradient = True
      rmi_loss = self.rmi_lower_bound(valid_onehot_labels_4D, probs_4D)
  
      return rmi_loss
  
file_path: PaddleSeg/paddleseg/models/losses/rmi_loss.py
imports: import numpy
  import paddle
  import paddle.nn
  import paddle.nn.functional
  from paddleseg.cvlibs import manager
label_desc: Use image node_id 3 for calling the RMILoss obj's underlying member method code with example usage: obj.forward_sigmoid(logits_4D, labels_4D, do_rmi) and returns: rmi_loss