File: __init__.py

package info (click to toggle)
onnxruntime 1.23.2%2Bdfsg-6
  • links: PTS, VCS
  • area: main
  • in suites: sid
  • size: 340,756 kB
  • sloc: cpp: 3,222,136; python: 188,267; ansic: 114,318; asm: 37,927; cs: 36,849; java: 10,962; javascript: 6,811; pascal: 4,126; sh: 2,996; xml: 705; objc: 281; makefile: 67
file content (27 lines) | stat: -rw-r--r-- 1,280 bytes parent folder | download | duplicates (3)
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
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License.

import os
import sys

# need to add the path to the ORT flatbuffers python module before we import anything else here.
# we also auto-magically adjust to whether we're running from the ORT repo, or from within the ORT python package
script_dir = os.path.dirname(os.path.realpath(__file__))
fbs_py_schema_dirname = "ort_flatbuffers_py"
if os.path.isdir(os.path.join(script_dir, fbs_py_schema_dirname)):
    # fbs bindings are in this directory, so we're running in the ORT python package
    ort_fbs_py_parent_dir = script_dir
else:
    # running directly from ORT repo, so fbs bindings are under onnxruntime/core/flatbuffers
    ort_root = os.path.abspath(os.path.join(script_dir, "..", "..", "..", ".."))
    ort_fbs_py_parent_dir = os.path.join(ort_root, "onnxruntime", "core", "flatbuffers")

sys.path.append(ort_fbs_py_parent_dir)

from .operator_type_usage_processors import (  # noqa: E402
    GloballyAllowedTypesOpTypeImplFilter,  # noqa: F401
    OperatorTypeUsageManager,  # noqa: F401
    OpTypeImplFilterInterface,  # noqa: F401
)
from .ort_model_processor import OrtFormatModelProcessor  # noqa: E402, F401
from .utils import create_config_from_models  # noqa: E402, F401