36 lines
795 B
Markdown
36 lines
795 B
Markdown
<p align="center">
|
|
<img src="./assets/logo.png" style="max-width: 50%;"/>
|
|
</p>
|
|
|
|
---
|
|
|
|
Neural network library written in Python completely from scratch, using only numpy.
|
|
|
|
## Usage
|
|
|
|
```
|
|
from pygrad.tensor import Tensor
|
|
|
|
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 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
|
|
|
|
- <https://github.com/geohot/tinygrad/>
|
|
- <https://github.com/karpathy/micrograd/>
|
|
|
|
## Copying
|
|
|
|
This is free and unencumbered software released into the public domain.
|