Исходный код СУБД RuDB — свободной СУБД с открытым исходным кодом на базе PostgreSQL
rudb
2 days ago bd039d1e92813358c5c5a1e346b49074baf513f2
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License.
 
"""ONNX Runtime WebGPU Plugin Execution Provider Python Package.
 
Provides helper functions to locate the plugin EP shared library and
retrieve the EP name for registration with ONNX Runtime.
"""
 
from __future__ import annotations
 
import pathlib
 
__all__ = [
    "get_ep_name",
    "get_ep_names",
    "get_library_path",
]
 
_module_dir = pathlib.Path(__file__).parent
 
 
def get_library_path() -> str:
    """Return the path to the WebGPU plugin EP shared library."""
    candidate_paths = [
        _module_dir / "onnxruntime_providers_webgpu.dll",
        _module_dir / "libonnxruntime_providers_webgpu.so",
        _module_dir / "libonnxruntime_providers_webgpu.dylib",
    ]
    paths = [p for p in candidate_paths if p.is_file()]
    if len(paths) != 1:
        raise RuntimeError(
            f"Expected exactly one WebGPU plugin EP library in {_module_dir}, "
            f"found {len(paths)}: {[p.name for p in paths]}"
        )
    return str(paths[0])
 
 
def get_ep_name() -> str:
    """Return the WebGPU Execution Provider name."""
    return "WebGpuExecutionProvider"
 
 
def get_ep_names() -> list[str]:
    """Return a list of EP names provided by this plugin."""
    return [get_ep_name()]