aboutsummaryrefslogtreecommitdiff
path: root/projects/autograd.html
diff options
context:
space:
mode:
authorRaghuram Subramani <raghus2247@gmail.com>2025-08-27 09:39:20 -0400
committerRaghuram Subramani <raghus2247@gmail.com>2025-08-27 09:39:20 -0400
commit1c42acca2491769a261de87be4904ba12ae5637e (patch)
treed4b9444d8d1a6b730f6629d09c45054f1b3d2508 /projects/autograd.html
parent18ffd40ca7445ad0c3012ed8610458294a16789c (diff)
.
Diffstat (limited to 'projects/autograd.html')
-rw-r--r--projects/autograd.html104
1 files changed, 104 insertions, 0 deletions
diff --git a/projects/autograd.html b/projects/autograd.html
new file mode 100644
index 0000000..4fe4ae0
--- /dev/null
+++ b/projects/autograd.html
@@ -0,0 +1,104 @@
+<!DOCTYPE html>
+<html lang="en">
+ <head>
+
+ <meta charset="UTF-8">
+ <meta name="viewport" content="width=device-width, initial-scale=1.0">
+ <meta http-equiv="X-UA-Compatible" content="ie=edge">
+ <meta name="description" content="RAGHURAM SUBRAMANI ~ COMPROMYSE | Hacker & Programmer">
+
+ <title>Autograd | COMPROMYSE</title>
+
+ <link rel="apple-touch-icon" sizes="180x180" href="/assets/favicon/apple-touch-icon.png">
+ <link rel="icon" type="image/png" sizes="32x32" href="/assets/favicon/favicon-32x32.png">
+ <link rel="icon" type="image/png" sizes="16x16" href="/assets/favicon/favicon-16x16.png">
+ <link rel="manifest" href="/assets/favicon/site.webmanifest">
+
+ <link href="/assets/stylesheet.css" rel="stylesheet" />
+
+ <link rel="preconnect" href="https://fonts.googleapis.com">
+ <link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
+ <link href="https://fonts.googleapis.com/css2?family=Jersey+15&display=swap" rel="stylesheet">
+
+ <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/highlight.js/11.11.1/styles/base16/ashes.min.css" defer>
+ <script src="https://cdnjs.cloudflare.com/ajax/libs/highlight.js/11.11.1/highlight.min.js"></script>
+ <script defer>hljs.highlightAll();</script>
+
+ </head>
+ <body class="bg-zinc-900 text-pink-300 font-['Jersey_15'] selection:text-pink-900 selection:bg-pink-100 lg:text-xl">
+ <div class="min-h-screen flex flex-col">
+
+ <nav class="w-full mx-auto mt-10">
+ <div class="flex flex-wrap items-center px-10 gap-4 text-center text-lg lg:text-2xl">
+
+ <a href="/" class="cursor-pointer font-bold hover:underline justify-center button">
+ COMPROMYSE
+ </a>
+
+ <div class="flex items-center gap-4 flex-wrap justify-center md:justify-left">
+ <a href="/projects" class="hover:underline">
+ [ PROJECTS ]
+ </a>
+
+ </div>
+
+ </div>
+</nav>
+
+
+ <div class="flex flex-grow flex-col py-8 px-14 items-center">
+
+ <div class="text-center flex flex-col gap-4 w-full max-w-100">
+ <h1 class="text-5xl font-semibold">Autograd</h1>
+ <div>
+ <h4 class="text-xl">An implementation of autograd / backpropagation.</h4>
+ <h6 class="text-center text-sm border-t-4 mt-2 py-1">Python</h6>
+ </div>
+
+ <a href="https://github.com/compromyse/autograd" target="_blank" class="button">SOURCE</a>
+ </div>
+
+ <div class="prose md:prose-lg lg:prose-2xl prose-pink prose-invert w-full max-w-256 pt-12">
+ <p>All you need to run a simple neural network using autograd is the following code:</p>
+
+<p>The code defines a data set <code>X</code>, expected output (or ground truth) <code>y</code>. It then trains the neural network by performing backward propagation (<code>.backward()</code>), then applies the calculated gradients through <code>.optimise()</code> along with a learning rate of <code>0.01</code>.</p>
+
+<p><pre><code class="py">from src.nn import MLP
+from src.loss import mse
+
+X = [
+ [ 0.0, 1.0, 2.0 ],
+ [ 2.0, 1.0, 0.0 ],
+ [ 2.0, 2.0, 2.0 ],
+ [ 3.0, 3.0, 3.0 ]
+]
+
+y = [ 1.0, -1.0, 1.0, -1.0 ]
+n = MLP(3, [ 4, 4, 1 ])
+
+for i in range(400):
+ pred = [ n(x) for x in X ]
+ loss = mse(y, pred)
+ loss.zero_grad()
+ loss.backward()
+ n.optimise(0.01)
+
+print(pred)
+</code></pre>
+</p>
+
+ </div>
+
+ </div>
+ <footer class="w-full pb-4 pt-12 px-8 text-sm md:text-lg">
+ <div class="text-center">
+ <p>The Quieter You Become, The More You Are Able To Hear.</p>
+ </div>
+</footer>
+
+
+ </div>
+ </body>
+</html>
+
+