def normalize_start_end_indices(dim_val: int, start: int, end: int) -> List[int]:
        """
        return normalized start and end indices which fall into a well-formed
        range like below:
        0 <= start <= end <= dim_val
        """
        # handle negative indices
        start = start if start >= 0 else dim_val + start
        start = 0 if start < 0 else start
        end = end if end >= 0 else dim_val + end
        end = 0 if end < 0 else end

        start = dim_val if start > dim_val else start
        end = dim_val if end > dim_val else end
        start = end if start > end else start
        return [start, end]

        return normalized start and end indices which fall into a well-formed
        range like below:
        0 <= start <= end <= dim_val
        
python/aitemplate/compiler/ops/tensor/dynamic_slice.py