class_docstr: Computes hamming loss.
  
  Hamming loss is the fraction of wrong labels to the total number
  of labels.
  
  In multi-class classification, hamming loss is calculated as the
  hamming distance between `y_true` and `y_pred`.
  In multi-label classification, hamming loss penalizes only the
  individual labels.
  
  Args:
      threshold: Elements of `y_pred` greater than threshold are
          converted to be 1, and the rest 0. If threshold is
          None, the argmax is converted to 1, and the rest 0.
      mode: multi-class or multi-label.
      name: (Optional) string name of the metric instance.
      dtype: (Optional) data type of the metric result.
  
  Usage:
  
  >>> # multi-class hamming loss
  >>> metric = HammingLoss(mode='multiclass', threshold=0.6)
  >>> y_true = np.array([[1.0, 0.0, 0.0, 0.0],
  ...                    [0.0, 0.0, 1.0, 0.0],
  ...                    [0.0, 0.0, 0.0, 1.0],
  ...                    [0.0, 1.0, 0.0, 0.0]], dtype=np.float32)
  >>> y_pred = np.array([[0.8, 0.1, 0.1, 0.0],
  ...                    [0.2, 0.0, 0.8, 0.0],
  ...                    [0.05, 0.05, 0.1, 0.8],
  ...                    [1.0, 0.0, 0.0, 0.0]], dtype=np.float32)
  >>> metric.update_state(y_true, y_pred)
  <tf.Variable 'UnreadVariable' shape=() dtype=float32, numpy=4.0>
  >>> metric.result().numpy()
  0.25
  >>> # multi-label hamming loss
  >>> metric = HammingLoss(mode='multilabel', threshold=0.8)
  >>> y_true = np.array([[1, 0, 1, 0],
  ...                    [0, 1, 0, 1],
  ...                    [0, 0, 0, 1]], dtype=np.int32)
  >>> y_pred = np.array([[0.82, 0.5, 0.90, 0],
  ...                    [0, 1, 0.4, 0.98],
  ...                    [0.89, 0.79, 0, 0.3]], dtype=np.float32)
  >>> metric.update_state(y_true, y_pred)
  <tf.Variable 'UnreadVariable' shape=() dtype=float32, numpy=3.0>
  >>> metric.result().numpy()
  0.16666667
code: def __init__(
      self,
      mode: str,
      name: str = "hamming_loss",
      threshold: Optional[FloatTensorLike] = None,
      dtype: AcceptableDTypes = None,
      **kwargs,
  ):
      super().__init__(
          hamming_loss_fn,
          name=name,
          dtype=dtype,
          mode=mode,
          threshold=threshold,
      )
  
file_path: addons/tensorflow_addons/metrics/hamming.py
imports: import tensorflow
  from tensorflow_addons.metrics.utils import MeanMetricWrapper
  from tensorflow_addons.utils.types import FloatTensorLike, TensorLike, AcceptableDTypes
  from typeguard import typechecked
  from typing import Union, Optional
label_desc: Use image node_id 1 to create a new HammingLoss object from inherited base classes: MeanMetricWrapper with example: obj = HammingLoss(mode, name, threshold, dtype)