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-07-27 10:03 +0800
« prev ^ index » next coverage.py v7.15.2, created at 2026-07-27 10:03 +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 "pattern",
39 "register_decompose_pass",
40 "register_fusion_pass",
41 "report_fuse",
42]
44from .pattern import pattern
46_LAZY_EXPORTS = {
47 "DecomposePass": ".base",
48 "FuseCheckResult": ".fuse_inspector",
49 "FusionBasePass": ".base",
50 "MatchResult": ".base",
51 "PassStage": ".base",
52 "PassContext": ".base",
53 "PatternMatcherConfig": ".base",
54 "PatternMatcherConfigBuilder": ".base",
55 "PatternFusionPass": ".base",
56 "SubgraphInput": ".base",
57 "SubgraphOutput": ".base",
58 "SubgraphBoundary": ".base",
59 "SubgraphRewriter": ".base",
60 "can_fuse": ".fuse_inspector",
61 "NodeIo": ".pattern",
62 "Pattern": ".pattern",
63 "create_pattern": ".pattern",
64 "create_replacement": ".replacement",
65 "clear_registered_passes": ".registry",
66 "get_registered_pass_by_descriptor_key": ".registry",
67 "get_registered_pass_dicts": ".registry",
68 "get_registered_passes": ".registry",
69 "register_decompose_pass": ".registry",
70 "register_fusion_pass": ".registry",
71 "report_fuse": ".fuse_inspector",
72}
75def __getattr__(name: str):
76 module_name = _LAZY_EXPORTS.get(name)
77 if module_name is None:
78 raise AttributeError(f"module {__name__!r} has no attribute {name!r}")
80 import importlib
82 module = importlib.import_module(module_name, __name__)
83 value = getattr(module, name)
84 globals()[name] = value
85 return value
88def __dir__():
89 return sorted(set(globals()) | set(__all__))