Coverage for /opt/cloud/slavespace/usr1/096471637100f3de0fcfc01072822a80/dttest/api/python/ge/ge/passes/__init__.py: 93%
14 statements
« prev ^ index » next coverage.py v7.15.2, created at 2026-08-04 11:36 +0800
« prev ^ index » next coverage.py v7.15.2, created at 2026-08-04 11:36 +0800
1#!/usr/bin/env python3
2# -*- coding: utf-8 -*-
3# -----------------------------------------------------------------------------------------------------------
4# Copyright (c) 2026 Huawei Technologies Co., Ltd.
5# This program is free software, you can redistribute it and/or modify it under the terms and conditions of
6# CANN Open Software License Agreement Version 2.0 (the "License").
7# Please refer to the License for details. You may not use this file except in compliance with the License.
8# THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, EITHER EXPRESS OR IMPLIED,
9# INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT, MERCHANTABILITY, OR FITNESS FOR A PARTICULAR PURPOSE.
10# See LICENSE in the root of the software repository for the full text of the License.
11# -----------------------------------------------------------------------------------------------------------
13"""Python GE passes public package."""
15__all__ = [
16 "DecomposePass",
17 "FuseCheckResult",
18 "FusionBasePass",
19 "MatchResult",
20 "NodeIo",
21 "PassStage",
22 "PassContext",
23 "Pattern",
24 "PatternMatcherConfig",
25 "PatternMatcherConfigBuilder",
26 "PatternFusionPass",
27 "SubgraphInput",
28 "SubgraphOutput",
29 "SubgraphBoundary",
30 "SubgraphRewriter",
31 "can_fuse",
32 "clear_registered_passes",
33 "create_pattern",
34 "create_replacement",
35 "get_registered_pass_by_descriptor_key",
36 "get_registered_pass_dicts",
37 "get_registered_passes",
38 "infer_shape",
39 "pattern",
40 "register_decompose_pass",
41 "register_fusion_pass",
42 "report_fuse",
43]
45from .pattern import pattern
47_LAZY_EXPORTS = {
48 "DecomposePass": ".base",
49 "FuseCheckResult": ".fuse_inspector",
50 "FusionBasePass": ".base",
51 "MatchResult": ".base",
52 "PassStage": ".base",
53 "PassContext": ".base",
54 "PatternMatcherConfig": ".base",
55 "PatternMatcherConfigBuilder": ".base",
56 "PatternFusionPass": ".base",
57 "SubgraphInput": ".base",
58 "SubgraphOutput": ".base",
59 "SubgraphBoundary": ".base",
60 "SubgraphRewriter": ".base",
61 "infer_shape": ".base",
62 "can_fuse": ".fuse_inspector",
63 "NodeIo": ".pattern",
64 "Pattern": ".pattern",
65 "create_pattern": ".pattern",
66 "create_replacement": ".replacement",
67 "clear_registered_passes": ".registry",
68 "get_registered_pass_by_descriptor_key": ".registry",
69 "get_registered_pass_dicts": ".registry",
70 "get_registered_passes": ".registry",
71 "register_decompose_pass": ".registry",
72 "register_fusion_pass": ".registry",
73 "report_fuse": ".fuse_inspector",
74}
77def __getattr__(name: str):
78 module_name = _LAZY_EXPORTS.get(name)
79 if module_name is None:
80 raise AttributeError(f"module {__name__!r} has no attribute {name!r}")
82 import importlib
84 module = importlib.import_module(module_name, __name__)
85 value = getattr(module, name)
86 globals()[name] = value
87 return value
90def __dir__():
91 return sorted(set(globals()) | set(__all__))