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