Skip to content

Commit 48b3afd

Browse files
authored
issue/561: 将调用 ntops 算子设为默认
* 以变量形式使用 `use_ntops` * 移除不需要的 `ntops.py`
1 parent c76c064 commit 48b3afd

2 files changed

Lines changed: 14 additions & 96 deletions

File tree

python/infinicore/__init__.py

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
import contextlib
2+
13
from infinicore.device import device
24
from infinicore.dtype import (
35
bfloat16,
@@ -24,7 +26,6 @@
2426
short,
2527
uint8,
2628
)
27-
from infinicore.ntops import use_ntops
2829
from infinicore.ops.add import add
2930
from infinicore.ops.attention import attention
3031
from infinicore.ops.matmul import matmul
@@ -68,8 +69,6 @@
6869
"long",
6970
"short",
7071
"uint8",
71-
# `ntops` integration.
72-
"use_ntops",
7372
# Operations.
7473
"add",
7574
"attention",
@@ -82,3 +81,15 @@
8281
"strided_from_blob",
8382
"zeros",
8483
]
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

Lines changed: 0 additions & 93 deletions
This file was deleted.

0 commit comments

Comments
 (0)