Skip to content

Commit 1c3c318

Browse files
xuzhao9meta-codesync[bot]
authored andcommitted
Guard against attribute error
Summary: Sometime third-party packages can be imported but there is no desired attribute, for example: ``` from .operator import Operator _ = tk.bf16_b200_gemm ^^^^^^^^^^^^^^^^^ AttributeError: module 'thunderkittens' has no attribute 'bf16_b200_gemm' ``` Handle attribute error in `try_import` Differential Revision: D102627731
1 parent ec05cc8 commit 1c3c318

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

tritonbench/utils/python_utils.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,5 +9,5 @@ def try_import(cond_name: str):
99
try:
1010
yield
1111
_caller_globals[cond_name] = True
12-
except (ImportError, ModuleNotFoundError, OSError) as e:
12+
except (ImportError, ModuleNotFoundError, OSError, AttributeError) as e:
1313
_caller_globals[cond_name] = False

0 commit comments

Comments
 (0)