def _process_one_slice_dst(
    slice_op: Operator, slice_output_tensor: Tensor, next_op: Operator
) -> bool:
    """
    Process one slice_output_tensor's dst op. Return True upon success.
    """
    if not _is_supported_op(next_op, slice_op):
        return False
    strided_op = next_op

    slice_input_tensor = slice_op._attrs["inputs"][0]
    slice_input_rank = slice_input_tensor._rank()
    slice_input_shape = slice_input_tensor._attrs["shape"]
    start_indices = slice_op._attrs["start_indices"]
    end_indices = slice_op._attrs["end_indices"]
    strided_op_name = strided_op._attrs["op"]

    # TODO: Currently, we only support a special case where all dimensions
    # are fully sliced except one. In such a case, we can use the same
    # TensorAccessor interface to update base tensors. We will revisit
    # this part once we refactor our TensorAccessor to support more general
    # senarios.
    slice_dim = None
    normalized_start_indices = []
    normalized_end_indices = []
    # Let's skip consecutive fully-sliced static dims starting from the
    # innermost dim
    for idx in reversed(range(slice_input_rank)):
        dim = slice_input_shape[idx]
        if not isinstance(dim, IntImm):
            break
        slice_dim = idx
        start_idx = start_indices[idx]
        end_idx = end_indices[idx]
        start_idx, end_idx = dynamic_slice.normalize_start_end_indices(
            dim.value(), start_idx, end_idx
        )
        normalized_start_indices.append(start_idx)
        normalized_end_indices.append(end_idx)
        if not _is_slice_full_range(dim, start_idx, end_idx):
            break
    # We encountered a dynamic dim before a valid slice_dim
    if slice_dim is None:
        return False

    invalid_slice = False
    # We got a valid slice_dim, but we need to keep checking if the
    # remaining slice indices are valid
    for idx in reversed(range(slice_dim)):
        dim = slice_input_shape[idx]
        start_idx = start_indices[idx]
        end_idx = end_indices[idx]
        if _is_slice_full_range(dim, start_idx, end_idx):
            start_idx = 0
            end_idx = MAX_INT32
            if isinstance(dim, IntImm):
                start_idx, end_idx = dynamic_slice.normalize_start_end_indices(
                    dim.value(), start_idx, end_idx
                )
            normalized_start_indices.append(start_idx)
            normalized_end_indices.append(end_idx)
        else:
            invalid_slice = True
            break

    if invalid_slice:
        return False
    offset = 0
    normalized_start_indices.reverse()
    normalized_end_indices.reverse()
    offset = normalized_start_indices[slice_dim]

    # Now let's check alignment
    if not _valid_alignment(
        strided_op,
        slice_dim,
        slice_output_tensor,
        slice_input_shape,
        normalized_start_indices,
        normalized_end_indices,
    ):
        return False

    to_be_updated_input_accessors = []
    for idx, input_tensor in enumerate(strided_op._attrs["inputs"]):
        if input_tensor is not slice_output_tensor:
            continue
        input_accessors = strided_op._attrs["input_accessors"]
        if input_accessors[idx].stride_dim is not None:
            return False

        if any(strided_op_name.startswith(n) for n in ("gemm", "group_gemm", "bmm")):
            if not transform_strided_ops_utils.gemm_stride_checker(
                input_accessors[idx], slice_dim
            ):
                return False
        to_be_updated_input_accessors.append(input_accessors[idx])

    for tc in to_be_updated_input_accessors:
        tc.update_base_tensor(slice_input_tensor, slice_dim, offset)

    transform_utils.replace_tensor_for_op(
        strided_op, slice_output_tensor, slice_input_tensor
    )
    return True
Process one slice_output_tensor's dst op. Return True upon success.
python/aitemplate/compiler/transform/transform_strided_slice.py