def METHOD_NAME(self, beziers: Tensor, num_levels: int) -> Tensor:
    """Map rois to corresponding feature levels by scales.
    - scale < finest_scale * 2: level 0
    - finest_scale * 2 <= scale < finest_scale * 4: level 1
    - finest_scale * 4 <= scale < finest_scale * 8: level 2
    - scale >= finest_scale * 8: level 3
    Args:
        beziers (Tensor): Input bezier control points, shape (k, 17).
        num_levels (int): Total level number.
    Returns:
        Tensor: Level index (0-based) of each RoI, shape (k, )
    """
    p1 = beziers[:, 1:3]
    p2 = beziers[:, 15:]
    scale = ((p1 - p2)**2).sum(dim=1).sqrt() * 2
    target_lvls = torch.floor(torch.log2(scale / self.finest_scale + 1e-6))
    target_lvls = target_lvls.clamp(min=0, max=num_levels - 1).long()
    return target_lvls