class_docstr: Implementation of Dice loss for image segmentation task.
  It supports binary, multiclass and multilabel cases
class_docstr_tok: ["Implementation","of","Dice","loss","for","image","segmentation","task",".","It","supports","binary",",","multiclass","and","multilabel","cases"]
docstr: :param mode: Metric mode {'binary', 'multiclass', 'multilabel'}
  :param classes: Optional list of classes that contribute in loss computation;
  By default, all channels are included.
  :param log_loss: If True, loss computed as `-log(jaccard)`; otherwise `1 - jaccard`
  :param from_logits: If True assumes input is raw logits
  :param smooth:
  :param ignore_index: Label that indicates ignored pixels (does not contribute to loss)
  :param eps: Small epsilon for numerical stability
docstr_tok: [":","param","mode",":","Metric","mode","{","'binary","'",",","'multiclass","'",",","'multilabel","'","}",":","param","classes",":","Optional","list","of","classes","that","contribute","in","loss","computation",";","By","default",",","all","channels","are","included",".",":","param","log_loss",":","If","True",",","loss","computed","as","`","-log","(","jaccard",")","`",";","otherwise","`","1","-","jaccard","`",":","param","from_logits",":","If","True","assumes","input","is","raw","logits",":","param","smooth",":",":","param","ignore_index",":","Label","that","indicates","ignored","pixels","(","does","not","contribute","to","loss",")",":","param","eps",":","Small","epsilon","for","numerical","stability"]
code: def __init__(
      self,
      mode: str,
      classes: List[int] = None,
      log_loss=False,
      from_logits=True,
      smooth: float = 0.0,
      ignore_index=None,
      eps=1e-7,
  ):
      """
  
      :param mode: Metric mode {'binary', 'multiclass', 'multilabel'}
      :param classes: Optional list of classes that contribute in loss computation;
      By default, all channels are included.
      :param log_loss: If True, loss computed as `-log(jaccard)`; otherwise `1 - jaccard`
      :param from_logits: If True assumes input is raw logits
      :param smooth:
      :param ignore_index: Label that indicates ignored pixels (does not contribute to loss)
      :param eps: Small epsilon for numerical stability
      """
      assert mode in {BINARY_MODE, MULTILABEL_MODE, MULTICLASS_MODE}
      super(DiceLoss, self).__init__()
      self.mode = mode
      if classes is not None:
          assert (
              mode != BINARY_MODE
          ), "Masking classes is not supported with mode=binary"
          classes = to_tensor(classes, dtype=torch.long)
  
      self.classes = classes
      self.from_logits = from_logits
      self.smooth = smooth
      self.eps = eps
      self.ignore_index = ignore_index
      self.log_loss = log_loss
  
file_path: pytorch-toolbelt/pytorch_toolbelt/losses/dice.py
imports: from typing import List
  import torch
  import torch.nn.functional
  from pytorch_toolbelt.utils.torch_utils import to_tensor
  from torch import Tensor
  from torch.nn.modules.loss import _Loss
  from .functional import soft_dice_score
label_desc: Use image node_id 1 to create a new DiceLoss object from inherited base classes: _Loss with example: obj = DiceLoss(mode, classes, log_loss, from_logits, smooth, ignore_index, eps)