Skip to content

Commit 08f6a94

Browse files
committed
issue/556 - support more inplace cases
1 parent 2e5b234 commit 08f6a94

22 files changed

Lines changed: 1188 additions & 1200 deletions

python/infinicore/ops/add.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,3 +7,5 @@ def add(input, other, *, out=None):
77
return Tensor(_infinicore.add(input._underlying, other._underlying))
88

99
_infinicore.add_(out._underlying, input._underlying, other._underlying)
10+
11+
return out

python/infinicore/ops/attention.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,3 +24,5 @@ def attention(q, k, v, k_cache, v_cache, pos, *, out=None):
2424
v_cache._underlying,
2525
pos,
2626
)
27+
28+
return out

python/infinicore/ops/causal_softmax.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,3 +7,5 @@ def causal_softmax(input, *, out=None):
77
return Tensor(_infinicore.causal_softmax(input._underlying))
88

99
_infinicore.causal_softmax_(out._underlying, input._underlying)
10+
11+
return out

python/infinicore/ops/matmul.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,3 +7,5 @@ def matmul(input, other, *, out=None):
77
return Tensor(_infinicore.matmul(input._underlying, other._underlying))
88

99
_infinicore.matmul_(out._underlying, input._underlying, other._underlying)
10+
11+
return out

python/infinicore/ops/rearrange.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,3 +7,5 @@ def rearrange(input, other, *, out=None):
77
return Tensor(_infinicore.rearrange(input._underlying))
88

99
_infinicore.rearrange_(out._underlying, input._underlying)
10+
11+
return out

python/infinicore/ops/rms_norm.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,3 +11,5 @@ def rms_norm(input, weight, epsilon=1e-5, *, out=None):
1111
_infinicore.rms_norm_(
1212
out._underlying, input._underlying, weight._underlying, epsilon
1313
)
14+
15+
return out

python/infinicore/ops/silu.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,3 +7,5 @@ def silu(input, *, out=None):
77
return Tensor(_infinicore.silu(input._underlying))
88

99
_infinicore.silu_(out._underlying, input._underlying)
10+
11+
return out

python/infinicore/ops/swiglu.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,3 +7,5 @@ def swiglu(input, other, *, out=None):
77
return Tensor(_infinicore.swiglu(input._underlying, other._underlying))
88

99
_infinicore.swiglu_(out._underlying, input._underlying, other._underlying)
10+
11+
return out

test/infinicore/framework/__init__.py

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
# [file name]: __init__.py
2-
# [file content begin]
31
from .base import TestConfig, TestRunner, TestCase, BaseOperatorTest
42
from .tensor import TensorSpec, TensorInitializer
53
from .utils import (
@@ -16,7 +14,6 @@
1614
from .devices import InfiniDeviceEnum, InfiniDeviceNames, torch_device_map
1715
from .datatypes import to_torch_dtype, to_infinicore_dtype
1816
from .runner import GenericTestRunner
19-
from .templates import BinaryOperatorTest, UnaryOperatorTest
2017

2118
__all__ = [
2219
"TensorSpec",
@@ -41,6 +38,4 @@
4138
"to_torch_dtype",
4239
"to_infinicore_dtype",
4340
"GenericTestRunner",
44-
"BinaryOperatorTest",
45-
"UnaryOperatorTest",
4641
]

0 commit comments

Comments
 (0)