Skip to content

Commit

Permalink
Move import to quantized
Browse files Browse the repository at this point in the history
  • Loading branch information
kirklandsign committed Aug 6, 2024
1 parent 21c9673 commit e7fad82
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 9 deletions.
9 changes: 0 additions & 9 deletions extension/pybindings/portable_lib.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,15 +29,6 @@
ExecuTorchModule, # noqa: F401
)

try:
from pathlib import Path
libs = list(Path(__file__).parent.parent.parent.resolve().glob("**/libquantized_ops_aot_lib.*"))
del Path
assert len(libs) == 1, f"Expected 1 library but got {len(libs)}"
_torch.ops.load_library(libs[0])
except:
pass

# Clean up so that `dir(portable_lib)` is the same as `dir(_portable_lib)`
# (apart from some __dunder__ names).
del _torch
21 changes: 21 additions & 0 deletions kernels/quantized/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
# 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.parent.parent.resolve().glob("**/libquantized_ops_aot_lib.*"))
del Path
assert len(libs) == 1, f"Expected 1 library but got {len(libs)}"
import torch as _torch
_torch.ops.load_library(libs[0])
del _torch
except:
import logging
logging.info("libquantized_ops_aot_lib is not loaded")
del logging



1 change: 1 addition & 0 deletions kernels/quantized/test/test_out_variants.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
quantized_decomposed_lib, # noqa
)

import executorch.kernels.quantized

class TestOutVariants(unittest.TestCase):
def setUp(self) -> None:
Expand Down

0 comments on commit e7fad82

Please sign in to comment.