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.4, created at 2026-08-18 20:49 +0800
« prev ^ index » next coverage.py v7.15.4, created at 2026-08-18 20:49 +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 "AnnotatedArgsContext",
18 "AnnotatedKernelArgs",
19 "AnnotatedKernelLaunchInfo",
20 "EagerExecuteOp",
21 "EagerOpExecutionContext",
22 "WorkspaceAddr",
23 "clear_registered_op_impls",
24 "get_declare_launch_args_ctx",
25 "get_execute_ctx",
26 "get_registered_op_impl_by_descriptor_key",
27 "get_registered_op_impl_dicts",
28 "get_registered_op_impls",
29 "register_op",
30 "register_op_impl",
31]
33_LAZY_EXPORTS = {
34 "BaseCustomOp": ".base",
35 "AnnotatedArgsContext": "._native",
36 "AnnotatedKernelArgs": "._native",
37 "AnnotatedKernelLaunchInfo": "._native",
38 "EagerExecuteOp": ".base",
39 "EagerOpExecutionContext": ".base",
40 "clear_registered_op_impls": ".registry",
41 "get_declare_launch_args_ctx": ".context",
42 "get_execute_ctx": ".context",
43 "get_registered_op_impl_by_descriptor_key": ".registry",
44 "get_registered_op_impl_dicts": ".registry",
45 "get_registered_op_impls": ".registry",
46 "register_op": ".proto",
47 "register_op_impl": ".registry",
48 "WorkspaceAddr": "._native",
49}
52def __getattr__(name: str):
53 module_name = _LAZY_EXPORTS.get(name)
54 if module_name is None:
55 raise AttributeError(f"module {__name__!r} has no attribute {name!r}")
57 import importlib
59 module = importlib.import_module(module_name, __name__)
60 value = getattr(module, name)
61 globals()[name] = value
62 return value
65def __dir__():
66 return sorted(set(globals()) | set(__all__))