MicroTensorGrad 1.0.1__tar.gz → 1.0.2__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {microtensorgrad-1.0.1/src/MicroTensorGrad.egg-info → microtensorgrad-1.0.2}/PKG-INFO +3 -1
- {microtensorgrad-1.0.1 → microtensorgrad-1.0.2}/README.md +2 -0
- {microtensorgrad-1.0.1 → microtensorgrad-1.0.2}/pyproject.toml +1 -1
- {microtensorgrad-1.0.1 → microtensorgrad-1.0.2}/src/MicroTensorGrad/Engine.py +10 -8
- {microtensorgrad-1.0.1 → microtensorgrad-1.0.2}/src/MicroTensorGrad/MLP.py +5 -0
- {microtensorgrad-1.0.1 → microtensorgrad-1.0.2/src/MicroTensorGrad.egg-info}/PKG-INFO +3 -1
- {microtensorgrad-1.0.1 → microtensorgrad-1.0.2}/LICENCE +0 -0
- {microtensorgrad-1.0.1 → microtensorgrad-1.0.2}/setup.cfg +0 -0
- {microtensorgrad-1.0.1 → microtensorgrad-1.0.2}/src/MicroTensorGrad/Optimizers.py +0 -0
- {microtensorgrad-1.0.1 → microtensorgrad-1.0.2}/src/MicroTensorGrad/__init__.py +0 -0
- {microtensorgrad-1.0.1 → microtensorgrad-1.0.2}/src/MicroTensorGrad/utils.py +0 -0
- {microtensorgrad-1.0.1 → microtensorgrad-1.0.2}/src/MicroTensorGrad.egg-info/SOURCES.txt +0 -0
- {microtensorgrad-1.0.1 → microtensorgrad-1.0.2}/src/MicroTensorGrad.egg-info/dependency_links.txt +0 -0
- {microtensorgrad-1.0.1 → microtensorgrad-1.0.2}/src/MicroTensorGrad.egg-info/requires.txt +0 -0
- {microtensorgrad-1.0.1 → microtensorgrad-1.0.2}/src/MicroTensorGrad.egg-info/top_level.txt +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: MicroTensorGrad
|
|
3
|
-
Version: 1.0.
|
|
3
|
+
Version: 1.0.2
|
|
4
4
|
Summary: A Tensor Based autograd engine used to train neural network based models
|
|
5
5
|
Author-email: Guettara Mohamed Amine <guettaraamine2@gmail.com>
|
|
6
6
|
License: MIT
|
|
@@ -22,6 +22,8 @@ A Tensor Based autograd engine used to train neural network based models.
|
|
|
22
22
|
- **Tensor-Based Autograd:** Automatic differentiation engine operating directly on Tensors.
|
|
23
23
|
- **Neural Network Training:** Built specifically to construct, backpropagate through, and train neural network architectures.
|
|
24
24
|
|
|
25
|
+
For more informations and guide, visit : https://github.com/Lberdy/MircoTensorGrad
|
|
26
|
+
|
|
25
27
|
## Installation
|
|
26
28
|
|
|
27
29
|
```bash
|
|
@@ -7,6 +7,8 @@ A Tensor Based autograd engine used to train neural network based models.
|
|
|
7
7
|
- **Tensor-Based Autograd:** Automatic differentiation engine operating directly on Tensors.
|
|
8
8
|
- **Neural Network Training:** Built specifically to construct, backpropagate through, and train neural network architectures.
|
|
9
9
|
|
|
10
|
+
For more informations and guide, visit : https://github.com/Lberdy/MircoTensorGrad
|
|
11
|
+
|
|
10
12
|
## Installation
|
|
11
13
|
|
|
12
14
|
```bash
|
|
@@ -5,14 +5,16 @@ class MicroTensor:
|
|
|
5
5
|
self.array = np_array
|
|
6
6
|
self.grad = 0
|
|
7
7
|
self.backward_ = lambda : None
|
|
8
|
+
|
|
9
|
+
def zero_grad(self):
|
|
10
|
+
self.grad = 0
|
|
8
11
|
|
|
9
12
|
def __matmul__(self, other):
|
|
10
|
-
# print(f"self array shape transpose: {self.array.transpose((0, 2, 1)).shape}, other array shape : {other.array.shape}")
|
|
11
13
|
out = MicroTensor(self.array.T@other.array)
|
|
12
14
|
|
|
13
15
|
def backward():
|
|
14
|
-
self.grad
|
|
15
|
-
other.grad
|
|
16
|
+
self.grad += (out.grad@other.array.transpose(0, 2, 1)).transpose(0, 2, 1)
|
|
17
|
+
other.grad += self.array@out.grad
|
|
16
18
|
|
|
17
19
|
out.backward_ = backward
|
|
18
20
|
|
|
@@ -33,8 +35,7 @@ class MicroTensor:
|
|
|
33
35
|
out = MicroTensor(np.where(self.array < 0, 0, self.array))
|
|
34
36
|
|
|
35
37
|
def backward():
|
|
36
|
-
self.grad += np.where(out.
|
|
37
|
-
|
|
38
|
+
self.grad += np.where(out.array < 0, 0, 1)*out.grad
|
|
38
39
|
|
|
39
40
|
out.backward_ = backward
|
|
40
41
|
|
|
@@ -44,7 +45,7 @@ class MicroTensor:
|
|
|
44
45
|
out = MicroTensor(np.tanh(self.array))
|
|
45
46
|
|
|
46
47
|
def backward():
|
|
47
|
-
self.grad += (1 - np.tanh(self.array))*out.grad
|
|
48
|
+
self.grad += (1 - np.tanh(self.array)**2)*out.grad
|
|
48
49
|
|
|
49
50
|
out.backward_ = backward
|
|
50
51
|
|
|
@@ -63,8 +64,9 @@ class MicroTensor:
|
|
|
63
64
|
return out
|
|
64
65
|
|
|
65
66
|
def Softmax(self):
|
|
66
|
-
|
|
67
|
-
|
|
67
|
+
epsilon = 1e-8
|
|
68
|
+
e_x = np.exp(self.array - np.max(self.array, axis=1, keepdims=True))
|
|
69
|
+
return e_x / (np.sum(e_x, axis=1, keepdims=True) + epsilon)
|
|
68
70
|
|
|
69
71
|
def CrossEntopyLoss(self, Y : np.ndarray):
|
|
70
72
|
out = MicroTensor(np.mean(-np.sum(Y*np.log(self.Softmax()), axis=1), axis=0))
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: MicroTensorGrad
|
|
3
|
-
Version: 1.0.
|
|
3
|
+
Version: 1.0.2
|
|
4
4
|
Summary: A Tensor Based autograd engine used to train neural network based models
|
|
5
5
|
Author-email: Guettara Mohamed Amine <guettaraamine2@gmail.com>
|
|
6
6
|
License: MIT
|
|
@@ -22,6 +22,8 @@ A Tensor Based autograd engine used to train neural network based models.
|
|
|
22
22
|
- **Tensor-Based Autograd:** Automatic differentiation engine operating directly on Tensors.
|
|
23
23
|
- **Neural Network Training:** Built specifically to construct, backpropagate through, and train neural network architectures.
|
|
24
24
|
|
|
25
|
+
For more informations and guide, visit : https://github.com/Lberdy/MircoTensorGrad
|
|
26
|
+
|
|
25
27
|
## Installation
|
|
26
28
|
|
|
27
29
|
```bash
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{microtensorgrad-1.0.1 → microtensorgrad-1.0.2}/src/MicroTensorGrad.egg-info/dependency_links.txt
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|