We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 4bffe4e commit cc29588Copy full SHA for cc29588
quanto/library/ops.py
@@ -1,3 +1,4 @@
1
+import warnings
2
from contextlib import contextmanager
3
4
import torch
@@ -41,7 +42,13 @@ def define(name, schema):
41
42
@torch.library.impl(f"quanto::{name}", "default")
43
def impl(*args, **kwargs):
44
if _ext_enabled:
- return getattr(torch.ops.quanto_ext, name)(*args, **kwargs)
45
+ try:
46
+ return getattr(torch.ops.quanto_ext, name)(*args, **kwargs)
47
+ except Exception as e:
48
+ warnings.warn(
49
+ f"A {type(e)} exception occured while calling the optimized kernel for quanto::{name}."
50
+ "Falling back to default implementation."
51
+ )
52
return getattr(torch.ops.quanto_py, name)(*args, **kwargs)
53
54
0 commit comments