We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent c76c064 commit 48b3afdCopy full SHA for 48b3afd
2 files changed
python/infinicore/__init__.py
@@ -1,3 +1,5 @@
1
+import contextlib
2
+
3
from infinicore.device import device
4
from infinicore.dtype import (
5
bfloat16,
@@ -24,7 +26,6 @@
24
26
short,
25
27
uint8,
28
)
-from infinicore.ntops import use_ntops
29
from infinicore.ops.add import add
30
from infinicore.ops.attention import attention
31
from infinicore.ops.matmul import matmul
@@ -68,8 +69,6 @@
68
69
"long",
70
"short",
71
"uint8",
- # `ntops` integration.
72
- "use_ntops",
73
# Operations.
74
"add",
75
"attention",
@@ -82,3 +81,15 @@
82
81
"strided_from_blob",
83
"zeros",
84
]
85
+use_ntops = False
86
87
+with contextlib.suppress(ImportError, ModuleNotFoundError):
88
+ import sys
89
90
+ import ntops
91
92
+ for op_name in ntops.torch.__all__:
93
+ getattr(ntops.torch, op_name).__globals__["torch"] = sys.modules[__name__]
94
95
+ use_ntops = True
python/infinicore/ntops.py
0 commit comments