def _fuse_strided_op_and_view_op(sorted_graph: List[Tensor]) -> List[Tensor]:
    """
    This pass fuses a view op with a strided op before or after it by using
    op._attrs["input_accessors"] or op._attrs["output_accessors"].
    It only works for ops with these fields.

    If there are multiple view ops, all these view ops will be fused into
    adjacent TensorAccessors if applicable.

    Note that are several conditions for fusion:

    1) The view op doesn't generate new dynamic dims.
    e.g. reshape(X[IntVar("batch_size"), 4], [-1, 2]) won't be fused with
    a strided op as a new dynamic dim is generated. This is because
    TensorAccessor doesn't support dynamic stride calculation for now.
    When the support is ready this condition can be removed.

    2) Some strided ops are not supported, e.g. group_gemm.
    This is because group_gemm has online_shape_inference which updates
    output tensor shapes. When this bug is fixed this condition can be
    removed.
    """

    num_ops = len(graph_utils.get_sorted_ops(sorted_graph))
    should_continue = True
    while should_continue:
        sorted_graph = _fuse_strided_op_and_view_op_single_pass(sorted_graph)
        new_num_ops = len(graph_utils.get_sorted_ops(sorted_graph))
        if num_ops == new_num_ops:
            should_continue = False
        num_ops = new_num_ops
    return sorted_graph

    This pass fuses a view op with a strided op before or after it by using
    op._attrs["input_accessors"] or op._attrs["output_accessors"].
    It only works for ops with these fields.

    If there are multiple view ops, all these view ops will be fused into
    adjacent TensorAccessors if applicable.

    Note that are several conditions for fusion:

    1) The view op doesn't generate new dynamic dims.
    e.g. reshape(X[IntVar("batch_size"), 4], [-1, 2]) won't be fused with
    a strided op as a new dynamic dim is generated. This is because
    TensorAccessor doesn't support dynamic stride calculation for now.
    When the support is ready this condition can be removed.

    2) Some strided ops are not supported, e.g. group_gemm.
    This is because group_gemm has online_shape_inference which updates
    output tensor shapes. When this bug is fixed this condition can be
    removed.
    
python/aitemplate/compiler/transform/transform_strided_op_and_view_op.py