File tree Expand file tree Collapse file tree 2 files changed +23
-3
lines changed
Expand file tree Collapse file tree 2 files changed +23
-3
lines changed Original file line number Diff line number Diff line change 1919try :
2020 import executorch .extension .pybindings .portable_lib
2121 import executorch .kernels .quantized # noqa
22- except :
22+ except ImportError as e :
2323 import logging
2424
25- logging .info (
26- "Failed to load portable_lib and quantized_aot_lib. To run quantized kernels AOT, either build "
25+ logging .warning (
26+ f"Failed to load portable_lib and quantized_aot_lib: { e } . To run quantized kernels AOT, either build "
27+ "Executorch with pybindings, or load your own custom built op library using torch.ops.load_library."
28+ )
29+ del logging
30+ except Exception as e :
31+ import logging
32+
33+ logging .warning (
34+ f"Unexpected error loading quantized ops: { e } . To run quantized kernels AOT, either build "
2735 "Executorch with pybindings, or load your own custom built op library using torch.ops.load_library."
2836 )
2937 del logging
Original file line number Diff line number Diff line change @@ -314,6 +314,18 @@ def make_alloc_node(
314314 return alloc
315315
316316
317+ # Ensure quantized operators are available for ToOutVarPass
318+ # This prevents "Missing out variants" errors for quantized_decomposed operators
319+ try :
320+ from torch .ao .quantization .fx ._decomposed import quantized_decomposed_lib # noqa: F401
321+ # Also import ExecutorTorch quantized kernels which define the out variants
322+ import executorch .extension .pybindings .portable_lib # noqa: F401
323+ import executorch .kernels .quantized # noqa: F401
324+ except ImportError :
325+ # Quantized operators are optional, continue without them
326+ pass
327+
328+
317329class ToOutVarPass (PassBase ):
318330 def __init__ (self , ignore_to_out_var_failure : bool = False ) -> None :
319331 self .ignore_to_out_var_failure = ignore_to_out_var_failure
You can’t perform that action at this time.
0 commit comments