function

assignment.gather_total_cost

def gather_total_cost(cost_matrix: Tensor, assignment: Tensor) -> Tensor

Sum the cost-matrix entries selected by a row-column assignment.

Parameters

NameTypeDescription
cost_matrixtorch.Tensor``(N, M)`` cost matrix.
assignmenttorch.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