File tree Expand file tree Collapse file tree 1 file changed +18
-0
lines changed Expand file tree Collapse file tree 1 file changed +18
-0
lines changed Original file line number Diff line number Diff line change 13
13
This API is experimental and subject to change without notice.
14
14
"""
15
15
16
+ import logging
17
+ import os
18
+ import sys
16
19
import warnings as _warnings
17
20
18
21
import executorch .exir ._warnings as _exir_warnings
28
31
# dependencies.
29
32
import torch as _torch
30
33
34
+ logger = logging .getLogger (__name__ )
35
+
36
+ # Update the DLL search path on Windows. This is the recommended way to handle native
37
+ # extensions.
38
+ if sys .platform == "win32" :
39
+ try :
40
+ # The extension DLL should be in the same directory as this file.
41
+ pybindings_dir = os .path .dirname (os .path .abspath (__file__ ))
42
+ os .add_dll_directory (pybindings_dir )
43
+ except Exception as e :
44
+ logger .error (
45
+ "Failed to add the pybinding extension DLL to the search path. The extension may not work." ,
46
+ e ,
47
+ )
48
+
31
49
# Let users import everything from the C++ _portable_lib extension as if this
32
50
# python file defined them. Although we could import these dynamically, it
33
51
# wouldn't preserve the static type annotations.
You can’t perform that action at this time.
0 commit comments