Update README to reflect added support for arrays

This commit is contained in:
Aodhnait Étaín 2020-11-15 19:04:49 +00:00
parent a75365a1ab
commit 2755798390

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