Skip to content

Commit d3e2363

Browse files
committed
matmul:测试ok
1 parent 3052b60 commit d3e2363

3 files changed

Lines changed: 11 additions & 12 deletions

File tree

front/py/deepx/nn/modules/linear.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
1-
from modules.module import Module
2-
from tensor import Tensor
1+
from .module import Module
2+
from deepx.tensor import Tensor
3+
34
class Linear(Module):
45
def __init__(self, in_features, out_features, bias=True,dtype:str="float32"):
56
super().__init__()
Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
1-
from deepx import zeros,ones,full
1+
import deepx
22
print()
33

4-
t1 = zeros([3,4,5],dtype='float32')
5-
t2 = ones([3,4,5],dtype='float32')
4+
t1 = deepx.zeros([3,4,5],dtype='float32')
5+
t2 = deepx.ones([3,4,5],dtype='float32')
66
t3 = t1+t2
7-
t4=full([3,4,5],fill_value=0.5)
7+
t4=deepx.full([3,4,5],fill_value=0.5)
88
t5=t4+t3
99
print(t5)

front/py/examples/2_ir/3_matmul.py

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,7 @@
22

33
print()
44

5-
t1 = zeros([3,4],dtype='float32')
6-
t2 = arange([4,5],dtype='float32')
7-
t3 = t1+t2
8-
t4=full([3,4,5],fill_value=0.5)
9-
t5=t4+t3
10-
print(t5)
5+
t1 = ones([3,4],dtype='float32')
6+
t2 = ones([4,5],dtype='float32')
7+
t3 = t1 @ t2
8+
print(t3)

0 commit comments

Comments
 (0)