math:: J(A,B) = \frac{|A\cap B|}{|A\cup B|} This function is a simple wrapper to get the task specific versions of this metric, which is done by setting the ``task`` argument to either ``'binary'``, ``'multiclass'`` or ``multilabel``. See the documentation of :func:`~torchmetrics.functional.classification.binary_jaccard_index`, :func:`~torchmetrics.functional.classification.multiclass_jaccard_index` and :func:`~torchmetrics.functional.classification.multilabel_jaccard_index` for the specific details of each argument influence and examples. Legacy Example: >>> from torch import randint, tensor >>> target = randint(0, 2, (10, 25, 25)) >>> pred = tensor(target) >>> pred[2:5, 7:13, 9:15] = 1 - pred[2:5, 7:13, 9:15] >>> jaccard_index(pred, target, task="multiclass", num_classes=2) tensor(0.9660) z+`num_classes` is expected to be `int` but `z was passed.`z*`num_labels` is expected to be `int` but `z