def get_mot_cls_target(self,
             mot_preds,
             mot_targets,
             gt_fut_masks,
             neg_inds):
        """"Get motion trajectory mode classification target.
        Args:
            mot_preds (Tensor): MultiModal traj preds with shape (num_box_preds, mot_fut_mode, fut_ts, 2).
            mot_targets (Tensor): Ground truth traj for each pred box with shape (num_box_preds, fut_ts, 2).
            gt_fut_masks (Tensor): Ground truth traj mask with shape (num_box_preds, fut_ts).
            neg_inds (Tensor): Negtive indices with shape (num_box_preds,)

        Returns:
            mot_labels (Tensor): traj cls labels (num_box_preds,).
        """

        cum_mot_preds = mot_preds.cumsum(dim=-2)
        cum_mot_targets = mot_targets.cumsum(dim=-2)

        # Get min pred mode indices.
        # (num_box_preds, mot_fut_mode, fut_ts)
        dist = torch.linalg.norm(cum_mot_targets[:, None, :, :] - cum_mot_preds, dim=-1)
        dist = dist * gt_fut_masks[:, None, :]
        dist = dist[..., -1]
        dist[torch.isnan(dist)] = dist[torch.isnan(dist)] * 0
        mot_labels = torch.argmin(dist, dim=-1)
        mot_labels[neg_inds] = self.mot_fut_mode

        return mot_labels
"Get motion trajectory mode classification target.
        Args:
            mot_preds (Tensor): MultiModal traj preds with shape (num_box_preds, mot_fut_mode, fut_ts, 2).
            mot_targets (Tensor): Ground truth traj for each pred box with shape (num_box_preds, fut_ts, 2).
            gt_fut_masks (Tensor): Ground truth traj mask with shape (num_box_preds, fut_ts).
            neg_inds (Tensor): Negtive indices with shape (num_box_preds,)

        Returns:
            mot_labels (Tensor): traj cls labels (num_box_preds,).
        
VADv2/VADv2_head.py