Compute match cost. Args: pred_logits (Tensor): Shape [num_query, C]. gt_logits (Tensor): Shape [num_gt, C]. Returns: Tensor: Match Cost matrix of shape (num_preds, num_gts).
(self, pred_logits: Tensor, gt_logits: Tensor)
| 80 | """TokenPredictionCost.""" |
| 81 | |
| 82 | def __call__(self, pred_logits: Tensor, gt_logits: Tensor) -> Tensor: |
| 83 | """Compute match cost. |
| 84 | |
| 85 | Args: |
| 86 | pred_logits (Tensor): Shape [num_query, C]. |
| 87 | gt_logits (Tensor): Shape [num_gt, C]. |
| 88 | Returns: |
| 89 | Tensor: Match Cost matrix of shape (num_preds, num_gts). |
| 90 | """ |
| 91 | token_map_cost = torch.matmul(pred_logits, gt_logits.transpose(0, 1)) |
| 92 | return token_map_cost * self.weight |
| 93 | |
| 94 | |
| 95 | @TASK_UTILS.register_module() |
nothing calls this directly
no outgoing calls
no test coverage detected