# transformers 5.24.1 (Apache-2.0), harvested by tools/harvest_corpus.py
=== input

    Compute the DICE loss, similar to generalized IOU for masks as follows:

    $$ \mathcal{L}_{\text{dice}(x, y) = 1 - \frac{2 * x \cap y }{x \cup y + 1}} $$

    In practice, since `labels` is a binary mask, (only 0s and 1s), dice can be computed as follow

    $$ \mathcal{L}_{\text{dice}(x, y) = 1 - \frac{2 * x * y }{x + y + 1}} $$

    Args:
        inputs (`torch.Tensor`):
            A tensor representing a mask.
        labels (`torch.Tensor`):
            A tensor with the same shape as inputs. Stores the binary classification labels for each element in inputs
            (0 for the negative class and 1 for the positive class).
        num_masks (`int`):
            The number of masks present in the current batch, used for normalization.

    Returns:
        `torch.Tensor`: The computed loss.
    
=== parse google
short_description: 'Compute the DICE loss, similar to generalized IOU for masks as follows:'
long_description: |
  $$ \mathcal{L}_{\text{dice}(x, y) = 1 - \frac{2 * x \cap y }{x \cup y + 1}} $$
  
  In practice, since `labels` is a binary mask, (only 0s and 1s), dice can be computed as follow
  
  $$ \mathcal{L}_{\text{dice}(x, y) = 1 - \frac{2 * x * y }{x + y + 1}} $$
blank_after_short_description: True
blank_after_long_description: True
style: google
- DocstringParam
  description: 'A tensor representing a mask.'
  kind: param
  key: 'param'
  arg_name: 'inputs'
  type_name: '`torch.Tensor`'
  is_optional: False
- DocstringParam
  description: |
    A tensor with the same shape as inputs. Stores the binary classification labels for each element in inputs
    (0 for the negative class and 1 for the positive class).
  kind: param
  key: 'param'
  arg_name: 'labels'
  type_name: '`torch.Tensor`'
  is_optional: False
- DocstringParam
  description: 'The number of masks present in the current batch, used for normalization.'
  kind: param
  key: 'param'
  arg_name: 'num_masks'
  type_name: '`int`'
  is_optional: False
- DocstringReturns
  description: 'The computed loss.'
  kind: returns
  key: 'returns'
  type_name: '`torch.Tensor`'
  is_generator: False
=== detect
google
=== compose google
Compute the DICE loss, similar to generalized IOU for masks as follows:

$$ \mathcal{L}_{\text{dice}(x, y) = 1 - \frac{2 * x \cap y }{x \cup y + 1}} $$

In practice, since `labels` is a binary mask, (only 0s and 1s), dice can be computed as follow

$$ \mathcal{L}_{\text{dice}(x, y) = 1 - \frac{2 * x * y }{x + y + 1}} $$

Args:
    inputs (`torch.Tensor`): A tensor representing a mask.
    labels (`torch.Tensor`): A tensor with the same shape as inputs. Stores the binary classification labels for each element in inputs
        (0 for the negative class and 1 for the positive class).
    num_masks (`int`): The number of masks present in the current batch, used for normalization.

Returns:
    `torch.Tensor`: The computed loss.
