assignment.gather_total_cost
def gather_total_cost(cost_matrix: Tensor, assignment: Tensor) -> TensorSum the cost-matrix entries selected by a row-column assignment.
Parameters
| Name | Type | Description |
|---|---|---|
| cost_matrix | torch.Tensor | ``(N, M)`` cost matrix. |
| assignment | torch.Tensor | ``(K, 2)`` long tensor of ``(row, col)`` index pairs. |
Returns
torch.Tensor — Scalar tensor holding the sum of ``cost_matrix[r, c]`` over the assigned pairs.
Source: unitrack/assignment/_utils.py:10