From 275579839038105d71e50197fc06c5abef55cdc3 Mon Sep 17 00:00:00 2001 From: aodhneine Date: Sun, 15 Nov 2020 19:04:49 +0000 Subject: [PATCH] Update README to reflect added support for arrays --- README.md | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index 672c627..5a8a29f 100644 --- a/README.md +++ b/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