Shortcuts

SQuAD

Module Interface

torchmetrics.SQuAD[source]

alias of _SQuAD

Functional Interface

torchmetrics.functional.squad(preds, target)[source]

Wrapper for deprecated import.

>>> preds = [{"prediction_text": "1976", "id": "56e10a3be3433e1400422b22"}]
>>> target = [{"answers": {"answer_start": [97], "text": ["1976"]},"id": "56e10a3be3433e1400422b22"}]
:rtype: :py:class:`~typing.Dict`\[:py:class:`str`, :py:class:`~torch.Tensor`]
>>> _squad(preds, target)
{'exact_match': tensor(100.), 'f1': tensor(100.)}