The pattern used by `FuseOpsByPattern`. It's mainly DFPattern but with other information to help during the fusion pass. Parameters ---------- name: str The name of pattern. Usually it starts with the name of backend, like 'cutlass.matmul'. pattern: DFPattern
| 860 | |
| 861 | @tvm_ffi.register_object("relax.transform.FusionPattern") |
| 862 | class FusionPattern(Object): |
| 863 | """ |
| 864 | The pattern used by `FuseOpsByPattern`. It's mainly DFPattern but with other |
| 865 | information to help during the fusion pass. |
| 866 | |
| 867 | Parameters |
| 868 | ---------- |
| 869 | name: str |
| 870 | The name of pattern. Usually it starts with the name of backend, like 'cutlass.matmul'. |
| 871 | |
| 872 | pattern: DFPattern |
| 873 | The dataflow pattern that will be used to match expressions that can be handled |
| 874 | by external backends. |
| 875 | |
| 876 | annotation_patterns: Mapping[str, DFPattern] |
| 877 | The map which is used to extract important expressions from the pattern match |
| 878 | result. All DFPattern in this map should be part of the `pattern`. |
| 879 | |
| 880 | check: Callable[[PatternCheckContext], bool] |
| 881 | The function to check whether the match result is accepted. |
| 882 | """ |
| 883 | |
| 884 | name: str |
| 885 | pattern: DFPattern |
| 886 | annotation_patterns: Mapping[str, DFPattern] |
| 887 | check: Callable[[PatternCheckContext], bool] |
| 888 | attrs_getter: Callable[[dict[str, Expr]], dict[str, str]] |
| 889 | |
| 890 | def __init__( |
| 891 | self, |
| 892 | name: str, |
| 893 | pattern: DFPattern, |
| 894 | annotation_patterns: Mapping[str, DFPattern] | None = None, |
| 895 | check: Callable[[PatternCheckContext], bool] | None = None, |
| 896 | attrs_getter: Callable[[dict[str, Expr]], dict[str, str]] | None = None, |
| 897 | ): |
| 898 | if annotation_patterns is None: |
| 899 | annotation_patterns = {} |
| 900 | self.__init_handle_by_constructor__( |
| 901 | _ffi_api.FusionPattern, name, pattern, annotation_patterns, check, attrs_getter |
| 902 | ) # type: ignore |
| 903 | |
| 904 | |
| 905 | def FuseOpsByPattern( |
no outgoing calls
no test coverage detected
searching dependent graphs…