aboutsummaryrefslogtreecommitdiff
path: root/example.py
diff options
context:
space:
mode:
authorRaghuram Subramani <raghus2247@gmail.com>2024-05-29 18:05:29 +0530
committerRaghuram Subramani <raghus2247@gmail.com>2024-05-29 18:08:53 +0530
commita4c99c97b66c6aed0737430aa9bdeb8ec64e3d9f (patch)
treea90c2b674a46d30b8c5bba59cd4000584089c7cb /example.py
parent3174341025787088358f5742bfc3e1e4e46fb9b8 (diff)
The real initial commit
Diffstat (limited to 'example.py')
-rwxr-xr-xexample.py19
1 files changed, 19 insertions, 0 deletions
diff --git a/example.py b/example.py
new file mode 100755
index 0000000..218adc3
--- /dev/null
+++ b/example.py
@@ -0,0 +1,19 @@
+#!/usr/bin/env python
+
+from src.value import Value
+from src.graph import Graph
+
+a = Value(2, label='a')
+b = Value(-3, label='b')
+c = Value(10, label='c')
+f = Value(-2, label='f')
+
+d = a * b; d.label = 'd'
+e = d + c; e.label = 'e'
+L = e * f; L.label = 'L'
+
+L.grad = 1.0
+e.grad = -2.0
+f.grad = 4.0
+
+Graph(L).show()