forked from pytorch/executorch
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy path__init__.py
More file actions
26 lines (22 loc) · 798 Bytes
/
__init__.py
File metadata and controls
26 lines (22 loc) · 798 Bytes
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
# Copyright (c) Meta Platforms, Inc. and affiliates.
# All rights reserved.
#
# This source code is licensed under the BSD-style license found in the
# LICENSE file in the root directory of this source tree.
try:
from pathlib import Path
libs = list(Path(__file__).parent.resolve().glob("*portable_custom_ops_aot_lib.*"))
del Path
if not libs:
raise RuntimeError("No portable_custom_ops_aot_lib library found.")
if len(libs) > 1:
raise RuntimeError(
f"Expected 1 portable_custom_ops_aot_lib library but found {len(libs)}."
)
import torch as _torch
_torch.ops.load_library(str(libs[0]))
del _torch
except Exception: # noqa: E722
import logging
logging.info("portable_custom_ops_aot_lib is not loaded")
del logging