Skip to content

Commit

Permalink
search backend ops for onnxruntime
Browse files Browse the repository at this point in the history
  • Loading branch information
lzhangzz committed Jan 25, 2022
1 parent 3c3110c commit 19d13b0
Showing 1 changed file with 13 additions and 12 deletions.
25 changes: 13 additions & 12 deletions mmdeploy/backend/onnxruntime/init_plugins.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,22 +2,23 @@
import glob
import os

_candidates = [
'../../../build/lib/libmmdeploy_onnxruntime_ops.so',
'../../../build/bin/*/mmdeploy_onnxruntime_ops.dll',
]


def get_ops_path() -> str:
"""Get the library path of onnxruntime custom ops.
Returns:
str: The library path to onnxruntime custom ops.
"""
# wildcard = os.path.abspath(
# os.path.join(
# os.path.dirname(__file__),
# '../../../build/lib/libmmdeploy_onnxruntime_ops.so'))
wildcard = os.path.abspath(
os.path.join(
os.path.dirname(__file__),
'../../../build/install/bin/mmdeploy_onnxruntime_ops.dll'))
for candidate in _candidates:
wildcard = os.path.abspath(
os.path.join(os.path.dirname(__file__), candidate))
paths = glob.glob(wildcard)
if paths:
lib_path = paths[0]
return lib_path

paths = glob.glob(wildcard)
lib_path = paths[0] if len(paths) > 0 else ''
return lib_path
return ''

0 comments on commit 19d13b0

Please sign in to comment.