class_docstr: Compute the Soft clDice loss defined in:
  
      Shit et al. (2021) clDice -- A Novel Topology-Preserving Loss Function
      for Tubular Structure Segmentation. (https://arxiv.org/abs/2003.07311)
  
  Adapted from:
      https://github.com/jocpae/clDice/blob/master/cldice_loss/pytorch/cldice.py#L38
class_docstr_tok: ["Compute","the","Soft","clDice","loss","defined","in",":","Shit","et","al",".","(","2021",")","clDice","--","A","Novel","Topology-Preserving","Loss","Function","for","Tubular","Structure","Segmentation",".","(","https",":","\/\/arxiv.org\/abs\/2003.07311",")","Adapted","from",":","https",":","\/\/github.com\/jocpae\/clDice\/blob\/master\/cldice_loss\/pytorch\/cldice.py","#","L38"]
code: def forward(
      self, y_true: torch.Tensor, y_pred: torch.Tensor
  ) -> torch.Tensor:
      dice = soft_dice(y_true, y_pred, self.smooth)
      skel_pred = soft_skel(y_pred, self.iter)
      skel_true = soft_skel(y_true, self.iter)
      tprec = (
          torch.sum(torch.multiply(skel_pred, y_true)[:, 1:, ...])
          + self.smooth
      ) / (torch.sum(skel_pred[:, 1:, ...]) + self.smooth)
      tsens = (
          torch.sum(torch.multiply(skel_true, y_pred)[:, 1:, ...])
          + self.smooth
      ) / (torch.sum(skel_true[:, 1:, ...]) + self.smooth)
      cl_dice = 1.0 - 2.0 * (tprec * tsens) / (tprec + tsens)
      total_loss: torch.Tensor = (
          1.0 - self.alpha
      ) * dice + self.alpha * cl_dice
      return total_loss
  
file_path: MONAI/monai/losses/cldice.py
imports: from __future__ import annotations
  import torch
  import torch.nn.functional
  from torch.nn.modules.loss import _Loss
label_desc: Use image node_id 2 for calling the SoftDiceclDiceLoss obj's underlying member method code with example usage: obj.forward(y_true, y_pred) and returns: total_loss