def get_best_preds(
    forecasted_trajectory: torch.Tensor,
    gt_trajectory: torch.Tensor
) -> float:
    """Compute min Average Displacement Error.
    Args:
        forecasted_trajectory: Predicted trajectory with shape [k, fut_ts, 2]
        gt_trajectory: Ground truth trajectory with shape [fut_ts, 2]
        gt_fut_masks: Ground truth traj mask with shape (fut_ts)
    Returns:
        best_forecasted_trajectory: Predicted trajectory with shape [fut_ts, 2]
    """

    # [k, fut_ts]
    dist = torch.linalg.norm(gt_trajectory[None] - forecasted_trajectory, dim=-1)
    dist = dist[..., -1]
    dist[torch.isnan(dist)] = 0
    min_mode_idx = torch.argmin(dist, dim=-1)

    return forecasted_trajectory[min_mode_idx]
Compute min Average Displacement Error.
    Args:
        forecasted_trajectory: Predicted trajectory with shape [k, fut_ts, 2]
        gt_trajectory: Ground truth trajectory with shape [fut_ts, 2]
        gt_fut_masks: Ground truth traj mask with shape (fut_ts)
    Returns:
        best_forecasted_trajectory: Predicted trajectory with shape [fut_ts, 2]
    
projects/mmdet3d_plugin/core/evaluation/metric_motion.py