Compare commits

...

2 commits

2 changed files with 9 additions and 3 deletions

1
.gitignore vendored
View file

@ -3,3 +3,4 @@ include/
lib/
lib64
pyvenv.cfg
__pycache__/

View file

@ -9,15 +9,20 @@ Neural network library written in Python completely from scratch, using only num
## Usage
```
import nn
from pygrad.tensor import Tensor
a, b = Tensor(2), Tensor(3)
a, b = Tensor(np.random.randn(3, 1)), Tensor(np.random.randn(1, 3))
c = a.mul(b)
d = c.exp()
d.backward()
print(a.grad, b.grad, c.grad)
# should output (1210.2863804782053, 806.8575869854702, 403.4287934927351)
# should output something like
# [[-16.51232262 -16.51232262 -16.51232262]]
# [[-53.88103349 -53.88103349 -53.88103349]]
# [[ 3.50417648 3.50417648 3.50417648]
# [15.67424587 15.67424587 15.67424587]
# [16.0131011 16.0131011 16.0131011 ]]
```
## References