Compare commits
2 commits
a75365a1ab
...
0ad8ac2fcd
Author | SHA1 | Date | |
---|---|---|---|
Aodhnait Étaín | 0ad8ac2fcd | ||
Aodhnait Étaín | 2755798390 |
1
.gitignore
vendored
1
.gitignore
vendored
|
@ -3,3 +3,4 @@ include/
|
|||
lib/
|
||||
lib64
|
||||
pyvenv.cfg
|
||||
__pycache__/
|
||||
|
|
11
README.md
11
README.md
|
@ -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
|
||||
|
|
Loading…
Reference in a new issue