xref: /aosp_15_r20/external/executorch/kernels/quantized/__init__.py (revision 523fa7a60841cd1ecfb9cc4201f1ca8b03ed023a)
1# Copyright (c) Meta Platforms, Inc. and affiliates.
2# All rights reserved.
3#
4# This source code is licensed under the BSD-style license found in the
5# LICENSE file in the root directory of this source tree.
6
7try:
8    from pathlib import Path
9
10    libs = list(Path(__file__).parent.resolve().glob("**/libquantized_ops_aot_lib.*"))
11    del Path
12    assert len(libs) == 1, f"Expected 1 library but got {len(libs)}"
13    import torch as _torch
14
15    _torch.ops.load_library(libs[0])
16    del _torch
17except:
18    import logging
19
20    logging.info("libquantized_ops_aot_lib is not loaded")
21    del logging
22