def get_plan_bd_target(self,
             ego_traj_preds,
             lane_preds,
             lane_score_preds,
             lane_bound_cls_idx=1,
             map_thresh=0.5):
        """"Get Trajectory mode classification target.
        Args:
            ego_traj_preds (Tensor): MultiModal traj preds with shape (mot_fut_mode, fut_ts, 2).
            lane_preds (Tensor): map preds/GT with shape (num_vec, num_pts, 2).
            lane_score_preds (Tensor): map scores with shape (num_vec, 3).
        Returns:
            traj_labels (Tensor): traj cls labels (1, mot_fut_mode).
        """
        # filter lane element according to confidence score and class
        # not_lane_bound_mask = lane_score_preds[..., lane_bound_cls_idx] < map_thresh
        not_lane_bound_mask = (lane_score_preds != lane_bound_cls_idx)

        # denormalize map pts
        lane_bound_preds = lane_preds.clone()
        # lane_bound_preds[..., 0:1] = (lane_bound_preds[..., 0:1] * (self.pc_range[3] -
        #                         self.pc_range[0]) + self.pc_range[0])
        # lane_bound_preds[..., 1:2] = (lane_bound_preds[..., 1:2] * (self.pc_range[4] -
        #                         self.pc_range[1]) + self.pc_range[1])
        # pad not-lane-boundary cls and low confidence preds
        lane_bound_preds[not_lane_bound_mask] = 1e6

        ego_traj_starts = ego_traj_preds[:, :-1, :]
        ego_traj_ends = ego_traj_preds
        padding_zeros = torch.zeros((self.plan_fut_mode, 1, 2), dtype=ego_traj_preds.dtype,
                                    device=ego_traj_preds.device)  # initial position
        ego_traj_starts = torch.cat((padding_zeros, ego_traj_starts), dim=1)
        V, P, _ = lane_bound_preds.size()
        ego_traj_expanded = ego_traj_ends.unsqueeze(2).unsqueeze(3)  # [num_plan_mode, T, 1, 1, 2]
        maps_expanded = lane_bound_preds.unsqueeze(0).unsqueeze(1)  # [1, 1, M, P, 2]

        dist = torch.linalg.norm(ego_traj_expanded - maps_expanded, dim=-1)  # [num_plan_mode, T, M, P]
        dist = dist.min(dim=-1, keepdim=False)[0]
        min_inst_idxs = torch.argmin(dist, dim=-1).tolist()
        mode_idxs = [[i] for i in range(dist.shape[0])]
        ts_idxs = [[i for i in range(dist.shape[1])] for j in range(dist.shape[0])]
        bd_target = lane_bound_preds.unsqueeze(0).unsqueeze(1).repeat(self.plan_fut_mode, self.fut_ts, 1, 1, 1)
        min_bd_insts = bd_target[mode_idxs, ts_idxs, min_inst_idxs]  # [B, T, P, 2]
        bd_inst_starts = min_bd_insts[:, :, :-1, :].flatten(0, 2)
        bd_inst_ends = min_bd_insts[:, :, 1:, :].flatten(0, 2)
        ego_traj_starts = ego_traj_starts.unsqueeze(2).repeat(1, 1, P-1, 1).flatten(0, 2)
        ego_traj_ends = ego_traj_ends.unsqueeze(2).repeat(1, 1, P-1, 1).flatten(0, 2)

        intersect_mask = segments_intersect(ego_traj_starts, ego_traj_ends,
                                            bd_inst_starts, bd_inst_ends)
        left_deviation = ego_traj_starts.new_tensor([-0.9, 2.4])
        right_deviation = ego_traj_starts.new_tensor([+0.9, 2.4])
        forward_deviation = ego_traj_starts.new_tensor([0., 2.4])
        intersect_mask_left = segments_intersect(ego_traj_starts + left_deviation, ego_traj_ends + left_deviation,
                                            bd_inst_starts, bd_inst_ends)
        intersect_mask_right = segments_intersect(ego_traj_starts + right_deviation, ego_traj_ends + right_deviation,
                                            bd_inst_starts, bd_inst_ends)
        intersect_mask_forward = segments_intersect(ego_traj_starts + forward_deviation, ego_traj_ends + forward_deviation,
                                            bd_inst_starts, bd_inst_ends)
        intersect_mask = intersect_mask | intersect_mask_left | intersect_mask_right | intersect_mask_forward
        # self.W = 1.85
        # self.H = 4.084
        intersect_mask = intersect_mask.reshape(self.plan_fut_mode, self.fut_ts, P-1)
        intersect_mask = intersect_mask.any(dim=-1).any(dim=-1)

        bd_overstep_labels = torch.zeros((self.plan_fut_mode), dtype=torch.long,
                                          device=ego_traj_preds.device)
        bd_overstep_labels[intersect_mask] = 1
        bd_overstep_labels[~intersect_mask] = 0

        return bd_overstep_labels
"Get Trajectory mode classification target.
        Args:
            ego_traj_preds (Tensor): MultiModal traj preds with shape (mot_fut_mode, fut_ts, 2).
            lane_preds (Tensor): map preds/GT with shape (num_vec, num_pts, 2).
            lane_score_preds (Tensor): map scores with shape (num_vec, 3).
        Returns:
            traj_labels (Tensor): traj cls labels (1, mot_fut_mode).
        
VADv2/VADv2_head.py