assignment.auto_assignment
def auto_assignment(cost: torch.Tensor, prefer: Prefer | str = Prefer.AUTO) -> tuple[torch.Tensor, torch.Tensor, torch.Tensor]Solve a single LAP via the empirically-fastest backend.
Parameters
| Name | Type | Description |
|---|---|---|
| cost | torch.Tensor | ``(N, M)`` cost matrix. May live on any device; non-CUDA paths copy to host transparently. |
| prefer = Prefer.AUTO | Prefer or str | Backend preference. See :class:`Prefer`. Default :attr:`Prefer.AUTO`. |
Returns
torch.Tensor — ``(K, 2)`` long tensor of matched ``(row, col)`` indices on the input tensor's device.
Raises
- RuntimeError — If ``prefer="cuda"`` is requested without a CUDA device.
Source: unitrack/assignment/_auto.py:55