Compare commits
No commits in common. "0ad8ac2fcde1ffbc8ef4b418897100fcee1332ed" and "a75365a1ab13e22a3e6a465b74139ee023bcef70" have entirely different histories.
0ad8ac2fcd
...
a75365a1ab
1
.gitignore
vendored
1
.gitignore
vendored
|
@ -3,4 +3,3 @@ include/
|
||||||
lib/
|
lib/
|
||||||
lib64
|
lib64
|
||||||
pyvenv.cfg
|
pyvenv.cfg
|
||||||
__pycache__/
|
|
||||||
|
|
11
README.md
11
README.md
|
@ -9,20 +9,15 @@ Neural network library written in Python completely from scratch, using only num
|
||||||
## Usage
|
## Usage
|
||||||
|
|
||||||
```
|
```
|
||||||
from pygrad.tensor import Tensor
|
import nn
|
||||||
|
|
||||||
a, b = Tensor(np.random.randn(3, 1)), Tensor(np.random.randn(1, 3))
|
a, b = Tensor(2), Tensor(3)
|
||||||
c = a.mul(b)
|
c = a.mul(b)
|
||||||
d = c.exp()
|
d = c.exp()
|
||||||
d.backward()
|
d.backward()
|
||||||
|
|
||||||
print(a.grad, b.grad, c.grad)
|
print(a.grad, b.grad, c.grad)
|
||||||
# should output something like
|
# should output (1210.2863804782053, 806.8575869854702, 403.4287934927351)
|
||||||
# [[-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
|
## References
|
||||||
|
|
Loading…
Reference in a new issue