Coverage for /opt/cloud/slavespace/usr1/096471637100f3de0fcfc01072822a80/dttest/api/python/ge/ge/custom_op/__init__.py: 92%
13 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 custom op public package."""
15__all__ = [
16 "BaseCustomOp",
17 "EagerExecuteOp",
18 "EagerOpExecutionContext",
19 "clear_registered_op_impls",
20 "get_execute_ctx",
21 "get_registered_op_impl_by_descriptor_key",
22 "get_registered_op_impl_dicts",
23 "get_registered_op_impls",
24 "register_op_impl",
25]
27_LAZY_EXPORTS = {
28 "BaseCustomOp": ".base",
29 "EagerExecuteOp": ".base",
30 "EagerOpExecutionContext": ".base",
31 "clear_registered_op_impls": ".registry",
32 "get_execute_ctx": ".context",
33 "get_registered_op_impl_by_descriptor_key": ".registry",
34 "get_registered_op_impl_dicts": ".registry",
35 "get_registered_op_impls": ".registry",
36 "register_op_impl": ".registry",
37}
40def __getattr__(name: str):
41 module_name = _LAZY_EXPORTS.get(name)
42 if module_name is None:
43 raise AttributeError(f"module {__name__!r} has no attribute {name!r}")
45 import importlib
47 module = importlib.import_module(module_name, __name__)
48 value = getattr(module, name)
49 globals()[name] = value
50 return value
53def __dir__():
54 return sorted(set(globals()) | set(__all__))