Coverage for /opt/cloud/slavespace/usr1/096471637100f3de0fcfc01072822a80/dttest/api/python/ge/ge/custom_op/_native.py: 94%
16 statements
« prev ^ index » next coverage.py v7.15.4, created at 2026-08-18 20:50 +0800
« prev ^ index » next coverage.py v7.15.4, created at 2026-08-18 20:50 +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"""Load and re-export the Python custom op native module."""
15from __future__ import annotations
17__all__ = [
18 "AnnotatedArgsContext",
19 "AnnotatedKernelArgs",
20 "AnnotatedKernelLaunchInfo",
21 "EagerOpExecutionContext",
22 "WorkspaceAddr",
23]
25from importlib import import_module
27from ge.runtime import _native as _runtime_native # noqa: F401
29from ._artifact_utils import find_prebuilt_artifact, load_native_module
32def _load_native_module():
33 artifact = find_prebuilt_artifact()
34 if artifact is not None:
35 return load_native_module(artifact.native_path)
36 return import_module("ge.custom_op._ge_custom_op_native")
39_native = _load_native_module()
41EagerOpExecutionContext = _native.EagerOpExecutionContext
42AnnotatedArgsContext = _native.AnnotatedArgsContext
43AnnotatedKernelArgs = _native.AnnotatedKernelArgs
44AnnotatedKernelLaunchInfo = _native.AnnotatedKernelLaunchInfo
45WorkspaceAddr = _native.WorkspaceAddr