code: def soft_jaccard_score(
      output: torch.Tensor,
      target: torch.Tensor,
      smooth: float = 0.0,
      eps: float = 1e-7,
      dims=None,
  ) -> torch.Tensor:
      """
  
      :param output:
      :param target:
      :param smooth:
      :param eps:
      :param dims:
      :return:
  
      Shape:
          - Input: :math:`(N, NC, *)` where :math:`*` means
              any number of additional dimensions
          - Target: :math:`(N, NC, *)`, same shape as the input
          - Output: scalar.
  
      """
      assert output.size() == target.size()
  
      if dims is not None:
          intersection = torch.sum(output * target, dim=dims)
          cardinality = torch.sum(output + target, dim=dims)
      else:
          intersection = torch.sum(output * target)
          cardinality = torch.sum(output + target)
  
      union = cardinality - intersection
      jaccard_score = (intersection + smooth) / (
          union + smooth
      ).clamp_min(eps)
      return jaccard_score
  
file_path: pytorch-toolbelt/pytorch_toolbelt/losses/functional.py
imports: import math
  from typing import Optional
  import torch
  import torch.nn.functional
  from ..utils import pytorch_toolbelt_deprecated
label_desc: Use image node_id 5 for calling a global function with example usage: soft_jaccard_score(output, target, smooth, eps, dims) and returns: jaccard_score