class_docstr: InstanceDiceLoss on both binary and thresh_bianry.
code: def forward(self, pred, batch):
      main_loss = self.main_loss(
          pred["binary"], batch["gt"], batch["mask"]
      )
      thresh_loss = self.thresh_loss(
          pred["thresh_binary"], batch["gt"], batch["mask"]
      )
      main_instance_loss = self.main_instance_loss(
          pred["binary"], batch["gt"], batch["mask"]
      )
      thresh_instance_loss = self.thresh_instance_loss(
          pred["thresh_binary"], batch["gt"], batch["mask"]
      )
      loss = (
          self.partial_loss(self.weights["main"], main_loss)
          + self.partial_loss(self.weights["thresh"], thresh_loss)
          + self.partial_loss(
              self.weights["main_instance"], main_instance_loss
          )
          + self.partial_loss(
              self.weights["thresh_instance"], thresh_instance_loss
          )
      )
      metrics = dict(
          main_loss=main_loss,
          thresh_loss=thresh_loss,
          main_instance_loss=main_instance_loss,
          thresh_instance_loss=thresh_instance_loss,
      )
      metrics.update(self.weights)
      return loss, metrics
  
imports: import sys
  import torch
  import torch.nn
label_desc: Use image node_id 3 for calling the AdaptiveInstanceDiceLoss obj's underlying member method code with example usage: obj.forward(pred, batch) and returns: loss,  metrics