Skip to content

Commit 78a22b1

Browse files
test
1 parent 67b9664 commit 78a22b1

File tree

2 files changed

+9
-5
lines changed

2 files changed

+9
-5
lines changed

PythonTensorTesting/PyTensorArray/__init__.py

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,21 @@
1-
from typing import Self
21
import numpy as np
32
import tensor as t
43

54
class Tensor:
6-
def __init__(self, arr, *args):
5+
def __init__(self, arr):
76
self.temp_tensor = t.TensorC(arr)
87

9-
def __add__(self, other) -> Self:
8+
def __add__(self, other):
109
result = Tensor(0);
1110
result.temp_tensor = self.temp_tensor + other.temp_tensor
1211
return result;
1312

14-
def __matmul__(self, other) -> Self:
13+
def __sub__(self, other):
14+
result = Tensor(0);
15+
result.temp_tensor = self.temp_tensor - other.temp_tensor
16+
return result;
17+
18+
def __matmul__(self, other):
1519
result = Tensor(0);
1620
result.temp_tensor = self.temp_tensor @ other.temp_tensor
1721
return result;

PythonTensorTesting/main.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
if __name__ == '__main__':
1010
t3 = np.array([[1, 2, 3], [4, 5, 6]])
1111
t1 = py_t_arr.Tensor([[1, 2.5, 3], [4, 5, 6]])
12-
t2 = py_t_arr.Tensor([[1, 2.5], [4, 5], [7, 8]])
12+
t2 = py_t_arr.Tensor([[1, 2.5], [4, 5], [7.5, 8]])
1313
t3 = t1 @ t2
1414
print("Hello")
1515
print(t3)

0 commit comments

Comments
 (0)