def _check_slice_op(slice_op: Operator, slice_dim: int) -> bool:
    """
    Return True if the slice_op's indices are valid for being merged
    """
    slice_shape = slice_op._attrs["outputs"][0].shape()
    if not shape_utils.all_static_dimensions(slice_shape, slice_dim):
        return False
    # we expect normalized start_indices and end_indices
    start_index = slice_op._attrs["start_indices"][slice_dim]
    if start_index is None or start_index < 0:
        return False
    end_index = slice_op._attrs["end_indices"][slice_dim]
    if end_index is None or end_index < 0 or end_index <= start_index:
        return False
    return True
Return True if the slice_op's indices are valid for being merged
python/aitemplate/compiler/transform/transform_merge_slice_ops.py