class_docstr: Compute the mean `Hinge loss`_ typically used for Support Vector Machines (SVMs) for multiclass tasks.
  
  The metric can be computed in two ways. Either, the definition by Crammer and Singer is used:
  
  .. math::
      \text{Hinge loss} = \max\left(0, 1 - \hat{y}_y + \max_{i \ne y} (\hat{y}_i)\right)
  
  Where :math:`y \in {0, ..., \mathrm{C}}` is the target class (where :math:`\mathrm{C}` is the number of classes),
  and :math:`\hat{y} \in \mathbb{R}^\mathrm{C}` is the predicted output per class. Alternatively, the metric can
  also be computed in one-vs-all approach, where each class is valued against all other classes in a binary fashion.
  
  As input to ``forward`` and ``update`` the metric accepts the following input:
  
  - ``preds`` (:class:`~torch.Tensor`): A float tensor of shape ``(N, C, ...)``. Preds should be a tensor
    containing probabilities or logits for each observation. If preds has values outside [0,1] range we consider
    the input to be logits and will auto apply softmax per sample.
  - ``target`` (:class:`~torch.Tensor`): An int tensor of shape ``(N, ...)``. Target should be a tensor containing
    ground truth labels, and therefore only contain values in the [0, n_classes-1] range (except if `ignore_index`
    is specified).
  
  .. note::
     Additional dimension ``...`` will be flattened into the batch dimension.
  
  As output to ``forward`` and ``compute`` the metric returns the following output:
  
  - ``mchl`` (:class:`~torch.Tensor`): A tensor containing the multi-class hinge loss.
  
  Args:
      num_classes: Integer specifying the number of classes
      squared:
          If True, this will compute the squared hinge loss. Otherwise, computes the regular hinge loss.
      multiclass_mode:
          Determines how to compute the metric
      ignore_index:
          Specifies a target value that is ignored and does not contribute to the metric calculation
      validate_args: bool indicating if input arguments and tensors should be validated for correctness.
          Set to ``False`` for faster computations.
      kwargs: Additional keyword arguments, see :ref:`Metric kwargs` for more info.
  
  Example:
      >>> from torchmetrics.classification import MulticlassHingeLoss
      >>> preds = torch.tensor([[0.25, 0.20, 0.55],
      ...                       [0.55, 0.05, 0.40],
      ...                       [0.10, 0.30, 0.60],
      ...                       [0.90, 0.05, 0.05]])
      >>> target = torch.tensor([0, 1, 2, 0])
      >>> mchl = MulticlassHingeLoss(num_classes=3)
      >>> mchl(preds, target)
      tensor(0.9125)
      >>> mchl = MulticlassHingeLoss(num_classes=3, squared=True)
      >>> mchl(preds, target)
      tensor(1.1131)
      >>> mchl = MulticlassHingeLoss(num_classes=3, multiclass_mode='one-vs-all')
      >>> mchl(preds, target)
      tensor([0.8750, 1.1250, 1.1000])
docstr: Update metric state.
docstr_tok: ["Update","metric","state","."]
code: def update(self, preds: Tensor, target: Tensor) -> None:
      """Update metric state."""
      if self.validate_args:
          _multiclass_hinge_loss_tensor_validation(
              preds, target, self.num_classes, self.ignore_index
          )
      preds, target = _multiclass_confusion_matrix_format(
          preds, target, self.ignore_index, convert_to_labels=False
      )
      measures, total = _multiclass_hinge_loss_update(
          preds, target, self.squared, self.multiclass_mode
      )
      self.measures += measures
      self.total += total
  
imports: from typing import Any, Optional, Sequence, Type, Union
  import torch
  from torch import Tensor
  from typing_extensions import Literal
  from torchmetrics.classification.base import _ClassificationTaskWrapper
  from torchmetrics.functional.classification.hinge import _binary_confusion_matrix_format, _binary_hinge_loss_arg_validation, _binary_hinge_loss_tensor_validation, _binary_hinge_loss_update, _hinge_loss_compute, _multiclass_confusion_matrix_format, _multiclass_hinge_loss_arg_validation, _multiclass_hinge_loss_tensor_validation, _multiclass_hinge_loss_update
  from torchmetrics.metric import Metric
  from torchmetrics.utilities.enums import ClassificationTaskNoMultilabel
  from torchmetrics.utilities.imports import _MATPLOTLIB_AVAILABLE
  from torchmetrics.utilities.plot import _AX_TYPE, _PLOT_OUT_TYPE
label_desc: Use image node_id 2 for calling the MulticlassHingeLoss obj's underlying member method code with example usage: obj.update(preds, target) without return types