def _fuse_slice_and_strided_op(
    sorted_graph: List[Tensor],
) -> List[Tensor]:
    """
    This pass detects patterns like below:
      x1 = slice(x, start_indices, end_indices)
      y = gemm_rcr(x1, w1)

    where gemm_rcr stands for a strided_op, which can be one of the followings:
    gemm-family ops, layernorm(s), elementwise ops, etc.
    When we detect such a pattern, we generate stride information for each input
    tensor with respect to its portion in slice. Later, the strided_op backend
    will generate strided accesses based on the stored stride information.
    """
    sorted_ops = graph_utils.get_sorted_ops(sorted_graph)
    for op in sorted_ops:
        op_type = op._attrs["op"]
        if op_type != "dynamic_slice":
            continue
        slice_op = op

        slice_outputs = slice_op._attrs["outputs"]
        if len(slice_outputs) != 1:
            continue
        slice_output_tensor = slice_outputs[0]
        slice_dsts = slice_output_tensor.dst_ops()
        for next_op in list(slice_dsts):
            _process_one_slice_dst(slice_op, slice_output_tensor, next_op)
        # We remove the slice_op from the graph if all of its output dsts are
        # valid strided ops. In such a case, output_tensor's "dsts" is empty
        # already, so we can just remove the op from the graph.
        if (
            len(slice_output_tensor.dst_ops()) == 0
            and not slice_output_tensor._attrs["is_output"]
        ):
            transform_utils.remove_tensor_from_sorted_graph(slice_output_tensor)
    return transform_utils.sanitize_sorted_graph(sorted_graph)

    This pass detects patterns like below:
      x1 = slice(x, start_indices, end_indices)
      y = gemm_rcr(x1, w1)

    where gemm_rcr stands for a strided_op, which can be one of the followings:
    gemm-family ops, layernorm(s), elementwise ops, etc.
    When we detect such a pattern, we generate stride information for each input
    tensor with respect to its portion in slice. Later, the strided_op backend
    will generate strided accesses based on the stored stride information.
    
python/aitemplate/compiler/transform/transform_strided_slice.py