Update example in README

This commit is contained in:
Aodhnait Étaín 2020-11-14 20:58:11 +00:00
parent a3afa0c797
commit a7004274f5
1 changed files with 5 additions and 3 deletions

View File

@ -7,11 +7,13 @@ Neural network library written in Python completely from scratch, using only num
```
import nn
a = nn.Tensor(1), b = nn.Tensor(2)
a, b = Tensor(2), Tensor(3)
c = a.mul(b)
c.backward()
d = c.exp()
d.backward()
print(a.grad, b.grad) # should output (2, 1)
print(a.grad, b.grad, c.grad)
# should output (1210.2863804782053, 806.8575869854702, 403.4287934927351)
```
## References