mirror of
https://github.com/MLSysBook/TinyTorch.git
synced 2026-06-06 18:25:55 -05:00
- Updated book generation to include 15_capstone with 5-star difficulty rating - Changed time estimate from '20-40 hours' to 'Capstone Project' for better visitor experience - Removed specific week references from project phases for more encouraging presentation - Maintained detailed project structure while making timeline more flexible - Ensures consistent 5-star rating for expert-level modules across the framework
759 lines
36 KiB
HTML
759 lines
36 KiB
HTML
|
||
|
||
<!DOCTYPE html>
|
||
|
||
|
||
<html lang="en" data-content_root="" >
|
||
|
||
<head>
|
||
<meta charset="utf-8" />
|
||
<meta name="viewport" content="width=device-width, initial-scale=1.0" /><meta name="generator" content="Docutils 0.18.1: http://docutils.sourceforge.net/" />
|
||
<meta content="Tiny🔥Torch: Build your own ML framework from scratch" property="og:title" />
|
||
<meta content="Learn ML systems by building them. Implement tensors, autograd, optimizers from scratch. Build the rocket ship, don't just be the astronaut." property="og:description" />
|
||
<meta content="https://mlsysbook.github.io/TinyTorch/" property="og:url" />
|
||
<meta content="website" property="og:type" />
|
||
<meta content="https://mlsysbook.github.io/TinyTorch/logo.png" property="og:image" />
|
||
<meta content="Tiny🔥Torch Course" property="og:site_name" />
|
||
<meta content="summary_large_image" name="twitter:card" />
|
||
<meta content="Tiny🔥Torch: Build your own ML framework" name="twitter:title" />
|
||
<meta content="Tiny🔥Torch is a minimalist framework for building machine learning systems from scratch—from tensors to systems." name="twitter:description" />
|
||
<meta content="https://mlsysbook.github.io/TinyTorch/logo.png" name="twitter:image" />
|
||
|
||
<title>Tiny🔥Torch: Build your own Machine Learning framework from scratch. — Tiny🔥Torch: Build your own Machine Learning framework from scratch</title>
|
||
|
||
|
||
|
||
<script data-cfasync="false">
|
||
document.documentElement.dataset.mode = localStorage.getItem("mode") || "";
|
||
document.documentElement.dataset.theme = localStorage.getItem("theme") || "light";
|
||
</script>
|
||
|
||
<!-- Loaded before other Sphinx assets -->
|
||
<link href="_static/styles/theme.css?digest=5b4479735964841361fd" rel="stylesheet" />
|
||
<link href="_static/styles/bootstrap.css?digest=5b4479735964841361fd" rel="stylesheet" />
|
||
<link href="_static/styles/pydata-sphinx-theme.css?digest=5b4479735964841361fd" rel="stylesheet" />
|
||
|
||
|
||
<link href="_static/vendor/fontawesome/6.1.2/css/all.min.css?digest=5b4479735964841361fd" rel="stylesheet" />
|
||
<link rel="preload" as="font" type="font/woff2" crossorigin href="_static/vendor/fontawesome/6.1.2/webfonts/fa-solid-900.woff2" />
|
||
<link rel="preload" as="font" type="font/woff2" crossorigin href="_static/vendor/fontawesome/6.1.2/webfonts/fa-brands-400.woff2" />
|
||
<link rel="preload" as="font" type="font/woff2" crossorigin href="_static/vendor/fontawesome/6.1.2/webfonts/fa-regular-400.woff2" />
|
||
|
||
<link rel="stylesheet" type="text/css" href="_static/pygments.css" />
|
||
<link rel="stylesheet" href="_static/styles/sphinx-book-theme.css?digest=14f4ca6b54d191a8c7657f6c759bf11a5fb86285" type="text/css" />
|
||
<link rel="stylesheet" type="text/css" href="_static/togglebutton.css" />
|
||
<link rel="stylesheet" type="text/css" href="_static/copybutton.css" />
|
||
<link rel="stylesheet" type="text/css" href="_static/mystnb.4510f1fc1dee50b3e5859aac5469c37c29e427902b24a333a5f9fcb2f0b3ac41.css" />
|
||
<link rel="stylesheet" type="text/css" href="_static/sphinx-thebe.css" />
|
||
<link rel="stylesheet" type="text/css" href="_static/design-style.4045f2051d55cab465a707391d5b2007.min.css" />
|
||
|
||
<!-- Pre-loaded scripts that we'll load fully later -->
|
||
<link rel="preload" as="script" href="_static/scripts/bootstrap.js?digest=5b4479735964841361fd" />
|
||
<link rel="preload" as="script" href="_static/scripts/pydata-sphinx-theme.js?digest=5b4479735964841361fd" />
|
||
<script src="_static/vendor/fontawesome/6.1.2/js/all.min.js?digest=5b4479735964841361fd"></script>
|
||
|
||
<script data-url_root="./" id="documentation_options" src="_static/documentation_options.js"></script>
|
||
<script src="_static/jquery.js"></script>
|
||
<script src="_static/underscore.js"></script>
|
||
<script src="_static/_sphinx_javascript_frameworks_compat.js"></script>
|
||
<script src="_static/doctools.js"></script>
|
||
<script src="_static/clipboard.min.js"></script>
|
||
<script src="_static/copybutton.js"></script>
|
||
<script src="_static/scripts/sphinx-book-theme.js?digest=5a5c038af52cf7bc1a1ec88eea08e6366ee68824"></script>
|
||
<script>let toggleHintShow = 'Click to show';</script>
|
||
<script>let toggleHintHide = 'Click to hide';</script>
|
||
<script>let toggleOpenOnPrint = 'true';</script>
|
||
<script src="_static/togglebutton.js"></script>
|
||
<script>var togglebuttonSelector = '.toggle, .admonition.dropdown';</script>
|
||
<script src="_static/design-tabs.js"></script>
|
||
<script>const THEBE_JS_URL = "https://unpkg.com/thebe@0.8.2/lib/index.js"
|
||
const thebe_selector = ".thebe,.cell"
|
||
const thebe_selector_input = "pre"
|
||
const thebe_selector_output = ".output, .cell_output"
|
||
</script>
|
||
<script async="async" src="_static/sphinx-thebe.js"></script>
|
||
<script>DOCUMENTATION_OPTIONS.pagename = 'intro';</script>
|
||
<link rel="index" title="Index" href="genindex.html" />
|
||
<link rel="search" title="Search" href="search.html" />
|
||
<link rel="next" title="🔬 Quick Exploration Path" href="usage-paths/quick-exploration.html" />
|
||
<meta name="viewport" content="width=device-width, initial-scale=1"/>
|
||
<meta name="docsearch:language" content="en"/>
|
||
</head>
|
||
|
||
|
||
<body data-bs-spy="scroll" data-bs-target=".bd-toc-nav" data-offset="180" data-bs-root-margin="0px 0px -60%" data-default-mode="">
|
||
|
||
|
||
|
||
<a class="skip-link" href="#main-content">Skip to main content</a>
|
||
|
||
<div id="pst-scroll-pixel-helper"></div>
|
||
|
||
|
||
<button type="button" class="btn rounded-pill" id="pst-back-to-top">
|
||
<i class="fa-solid fa-arrow-up"></i>
|
||
Back to top
|
||
</button>
|
||
|
||
|
||
<input type="checkbox"
|
||
class="sidebar-toggle"
|
||
name="__primary"
|
||
id="__primary"/>
|
||
<label class="overlay overlay-primary" for="__primary"></label>
|
||
|
||
<input type="checkbox"
|
||
class="sidebar-toggle"
|
||
name="__secondary"
|
||
id="__secondary"/>
|
||
<label class="overlay overlay-secondary" for="__secondary"></label>
|
||
|
||
<div class="search-button__wrapper">
|
||
<div class="search-button__overlay"></div>
|
||
<div class="search-button__search-container">
|
||
<form class="bd-search d-flex align-items-center"
|
||
action="search.html"
|
||
method="get">
|
||
<i class="fa-solid fa-magnifying-glass"></i>
|
||
<input type="search"
|
||
class="form-control"
|
||
name="q"
|
||
id="search-input"
|
||
placeholder="Search this book..."
|
||
aria-label="Search this book..."
|
||
autocomplete="off"
|
||
autocorrect="off"
|
||
autocapitalize="off"
|
||
spellcheck="false"/>
|
||
<span class="search-button__kbd-shortcut"><kbd class="kbd-shortcut__modifier">Ctrl</kbd>+<kbd>K</kbd></span>
|
||
</form></div>
|
||
</div>
|
||
|
||
<nav class="bd-header navbar navbar-expand-lg bd-navbar">
|
||
</nav>
|
||
|
||
<div class="bd-container">
|
||
<div class="bd-container__inner bd-page-width">
|
||
|
||
<div class="bd-sidebar-primary bd-sidebar">
|
||
|
||
|
||
|
||
<div class="sidebar-header-items sidebar-primary__section">
|
||
|
||
|
||
|
||
|
||
</div>
|
||
|
||
<div class="sidebar-primary-items__start sidebar-primary__section">
|
||
<div class="sidebar-primary-item">
|
||
|
||
|
||
|
||
<a class="navbar-brand logo" href="#">
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
<img src="_static/logo.png" class="logo__image only-light" alt="Tiny🔥Torch: Build your own Machine Learning framework from scratch - Home"/>
|
||
<script>document.write(`<img src="_static/logo.png" class="logo__image only-dark" alt="Tiny🔥Torch: Build your own Machine Learning framework from scratch - Home"/>`);</script>
|
||
|
||
|
||
</a></div>
|
||
<div class="sidebar-primary-item"><nav class="bd-links" id="bd-docs-nav" aria-label="Main">
|
||
<div class="bd-toc-item navbar-nav active">
|
||
|
||
<ul class="nav bd-sidenav bd-sidenav__home-link">
|
||
<li class="toctree-l1 current active">
|
||
<a class="reference internal" href="#">
|
||
Tiny🔥Torch: Build your own Machine Learning framework from scratch.
|
||
</a>
|
||
</li>
|
||
</ul>
|
||
<p aria-level="2" class="caption" role="heading"><span class="caption-text">Usage Paths</span></p>
|
||
<ul class="nav bd-sidenav">
|
||
<li class="toctree-l1"><a class="reference internal" href="usage-paths/quick-exploration.html">🔬 Quick Exploration</a></li>
|
||
<li class="toctree-l1"><a class="reference internal" href="usage-paths/serious-development.html">🏗️ Serious Development</a></li>
|
||
<li class="toctree-l1"><a class="reference internal" href="usage-paths/classroom-use.html">👨🏫 Classroom Use</a></li>
|
||
</ul>
|
||
<p aria-level="2" class="caption" role="heading"><span class="caption-text">Foundation</span></p>
|
||
<ul class="nav bd-sidenav">
|
||
<li class="toctree-l1"><a class="reference internal" href="chapters/01-setup.html">1. Setup</a></li>
|
||
<li class="toctree-l1"><a class="reference internal" href="chapters/02-tensor.html">2. Tensors</a></li>
|
||
<li class="toctree-l1"><a class="reference internal" href="chapters/03-activations.html">3. Activations</a></li>
|
||
</ul>
|
||
<p aria-level="2" class="caption" role="heading"><span class="caption-text">Building Blocks</span></p>
|
||
<ul class="nav bd-sidenav">
|
||
<li class="toctree-l1"><a class="reference internal" href="chapters/04-layers.html">4. Layers</a></li>
|
||
<li class="toctree-l1"><a class="reference internal" href="chapters/05-networks.html">5. Networks</a></li>
|
||
<li class="toctree-l1"><a class="reference internal" href="chapters/06-cnn.html">6. CNNs</a></li>
|
||
</ul>
|
||
<p aria-level="2" class="caption" role="heading"><span class="caption-text">Training Systems</span></p>
|
||
<ul class="nav bd-sidenav">
|
||
<li class="toctree-l1"><a class="reference internal" href="chapters/07-dataloader.html">7. DataLoader</a></li>
|
||
<li class="toctree-l1"><a class="reference internal" href="chapters/08-autograd.html">8. Autograd</a></li>
|
||
<li class="toctree-l1"><a class="reference internal" href="chapters/09-optimizers.html">9. Optimizers</a></li>
|
||
<li class="toctree-l1"><a class="reference internal" href="chapters/10-training.html">10. Training</a></li>
|
||
</ul>
|
||
<p aria-level="2" class="caption" role="heading"><span class="caption-text">Production & Performance</span></p>
|
||
<ul class="nav bd-sidenav">
|
||
<li class="toctree-l1"><a class="reference internal" href="chapters/11-compression.html">11. Compression</a></li>
|
||
<li class="toctree-l1"><a class="reference internal" href="chapters/12-kernels.html">12. Kernels</a></li>
|
||
<li class="toctree-l1"><a class="reference internal" href="chapters/13-benchmarking.html">13. Benchmarking</a></li>
|
||
<li class="toctree-l1"><a class="reference internal" href="chapters/14-mlops.html">14. MLOps</a></li>
|
||
</ul>
|
||
<p aria-level="2" class="caption" role="heading"><span class="caption-text">Capstone Project</span></p>
|
||
<ul class="nav bd-sidenav">
|
||
<li class="toctree-l1"><a class="reference internal" href="chapters/15-capstone.html">15. Capstone</a></li>
|
||
</ul>
|
||
|
||
</div>
|
||
</nav></div>
|
||
</div>
|
||
|
||
|
||
<div class="sidebar-primary-items__end sidebar-primary__section">
|
||
</div>
|
||
|
||
<div id="rtd-footer-container"></div>
|
||
|
||
|
||
</div>
|
||
|
||
<main id="main-content" class="bd-main">
|
||
|
||
|
||
|
||
<div class="sbt-scroll-pixel-helper"></div>
|
||
|
||
<div class="bd-content">
|
||
<div class="bd-article-container">
|
||
|
||
<div class="bd-header-article">
|
||
<div class="header-article-items header-article__inner">
|
||
|
||
<div class="header-article-items__start">
|
||
|
||
<div class="header-article-item"><label class="sidebar-toggle primary-toggle btn btn-sm" for="__primary" title="Toggle primary sidebar" data-bs-placement="bottom" data-bs-toggle="tooltip">
|
||
<span class="fa-solid fa-bars"></span>
|
||
</label></div>
|
||
|
||
</div>
|
||
|
||
|
||
<div class="header-article-items__end">
|
||
|
||
<div class="header-article-item">
|
||
|
||
<div class="article-header-buttons">
|
||
|
||
|
||
|
||
|
||
|
||
<div class="dropdown dropdown-source-buttons">
|
||
<button class="btn dropdown-toggle" type="button" data-bs-toggle="dropdown" aria-expanded="false" aria-label="Source repositories">
|
||
<i class="fab fa-github"></i>
|
||
</button>
|
||
<ul class="dropdown-menu">
|
||
|
||
|
||
|
||
<li><a href="https://github.com/mlsysbook/TinyTorch" target="_blank"
|
||
class="btn btn-sm btn-source-repository-button dropdown-item"
|
||
title="Source repository"
|
||
data-bs-placement="left" data-bs-toggle="tooltip"
|
||
>
|
||
|
||
|
||
<span class="btn__icon-container">
|
||
<i class="fab fa-github"></i>
|
||
</span>
|
||
<span class="btn__text-container">Repository</span>
|
||
</a>
|
||
</li>
|
||
|
||
|
||
|
||
|
||
<li><a href="https://github.com/mlsysbook/TinyTorch/edit/main/book/intro.md" target="_blank"
|
||
class="btn btn-sm btn-source-edit-button dropdown-item"
|
||
title="Suggest edit"
|
||
data-bs-placement="left" data-bs-toggle="tooltip"
|
||
>
|
||
|
||
|
||
<span class="btn__icon-container">
|
||
<i class="fas fa-pencil-alt"></i>
|
||
</span>
|
||
<span class="btn__text-container">Suggest edit</span>
|
||
</a>
|
||
</li>
|
||
|
||
|
||
|
||
|
||
<li><a href="https://github.com/mlsysbook/TinyTorch/issues/new?title=Issue%20on%20page%20%2Fintro.html&body=Your%20issue%20content%20here." target="_blank"
|
||
class="btn btn-sm btn-source-issues-button dropdown-item"
|
||
title="Open an issue"
|
||
data-bs-placement="left" data-bs-toggle="tooltip"
|
||
>
|
||
|
||
|
||
<span class="btn__icon-container">
|
||
<i class="fas fa-lightbulb"></i>
|
||
</span>
|
||
<span class="btn__text-container">Open issue</span>
|
||
</a>
|
||
</li>
|
||
|
||
</ul>
|
||
</div>
|
||
|
||
|
||
|
||
|
||
|
||
|
||
<div class="dropdown dropdown-download-buttons">
|
||
<button class="btn dropdown-toggle" type="button" data-bs-toggle="dropdown" aria-expanded="false" aria-label="Download this page">
|
||
<i class="fas fa-download"></i>
|
||
</button>
|
||
<ul class="dropdown-menu">
|
||
|
||
|
||
|
||
<li><a href="_sources/intro.md" target="_blank"
|
||
class="btn btn-sm btn-download-source-button dropdown-item"
|
||
title="Download source file"
|
||
data-bs-placement="left" data-bs-toggle="tooltip"
|
||
>
|
||
|
||
|
||
<span class="btn__icon-container">
|
||
<i class="fas fa-file"></i>
|
||
</span>
|
||
<span class="btn__text-container">.md</span>
|
||
</a>
|
||
</li>
|
||
|
||
|
||
|
||
|
||
<li>
|
||
<button onclick="window.print()"
|
||
class="btn btn-sm btn-download-pdf-button dropdown-item"
|
||
title="Print to PDF"
|
||
data-bs-placement="left" data-bs-toggle="tooltip"
|
||
>
|
||
|
||
|
||
<span class="btn__icon-container">
|
||
<i class="fas fa-file-pdf"></i>
|
||
</span>
|
||
<span class="btn__text-container">.pdf</span>
|
||
</button>
|
||
</li>
|
||
|
||
</ul>
|
||
</div>
|
||
|
||
|
||
|
||
|
||
<button onclick="toggleFullScreen()"
|
||
class="btn btn-sm btn-fullscreen-button"
|
||
title="Fullscreen mode"
|
||
data-bs-placement="bottom" data-bs-toggle="tooltip"
|
||
>
|
||
|
||
|
||
<span class="btn__icon-container">
|
||
<i class="fas fa-expand"></i>
|
||
</span>
|
||
|
||
</button>
|
||
|
||
|
||
|
||
<script>
|
||
document.write(`
|
||
<button class="btn btn-sm navbar-btn theme-switch-button" title="light/dark" aria-label="light/dark" data-bs-placement="bottom" data-bs-toggle="tooltip">
|
||
<span class="theme-switch nav-link" data-mode="light"><i class="fa-solid fa-sun fa-lg"></i></span>
|
||
<span class="theme-switch nav-link" data-mode="dark"><i class="fa-solid fa-moon fa-lg"></i></span>
|
||
<span class="theme-switch nav-link" data-mode="auto"><i class="fa-solid fa-circle-half-stroke fa-lg"></i></span>
|
||
</button>
|
||
`);
|
||
</script>
|
||
|
||
|
||
<script>
|
||
document.write(`
|
||
<button class="btn btn-sm navbar-btn search-button search-button__button" title="Search" aria-label="Search" data-bs-placement="bottom" data-bs-toggle="tooltip">
|
||
<i class="fa-solid fa-magnifying-glass fa-lg"></i>
|
||
</button>
|
||
`);
|
||
</script>
|
||
<label class="sidebar-toggle secondary-toggle btn btn-sm" for="__secondary"title="Toggle secondary sidebar" data-bs-placement="bottom" data-bs-toggle="tooltip">
|
||
<span class="fa-solid fa-list"></span>
|
||
</label>
|
||
</div></div>
|
||
|
||
</div>
|
||
|
||
</div>
|
||
</div>
|
||
|
||
|
||
|
||
<div id="jb-print-docs-body" class="onlyprint">
|
||
<h1>Tiny🔥Torch: Build your own Machine Learning framework from scratch.</h1>
|
||
<!-- Table of contents -->
|
||
<div id="print-main-content">
|
||
<div id="jb-print-toc">
|
||
|
||
<div>
|
||
<h2> Contents </h2>
|
||
</div>
|
||
<nav aria-label="Page">
|
||
<ul class="visible nav section-nav flex-column">
|
||
<li class="toc-h2 nav-item toc-entry"><a class="reference internal nav-link" href="#the-core-difference">💡 <strong>The Core Difference</strong></a></li>
|
||
<li class="toc-h2 nav-item toc-entry"><a class="reference internal nav-link" href="#learning-philosophy-build-use-master">🎓 <strong>Learning Philosophy: Build, Use, Master</strong></a><ul class="nav section-nav flex-column">
|
||
<li class="toc-h3 nav-item toc-entry"><a class="reference internal nav-link" href="#example-activation-functions"><strong>Example: Activation Functions</strong></a></li>
|
||
</ul>
|
||
</li>
|
||
<li class="toc-h2 nav-item toc-entry"><a class="reference internal nav-link" href="#course-journey-15-modules">📚 <strong>Course Journey: 15 Modules</strong></a></li>
|
||
<li class="toc-h2 nav-item toc-entry"><a class="reference internal nav-link" href="#complete-system-integration">🔗 <strong>Complete System Integration</strong></a><ul class="nav section-nav flex-column">
|
||
<li class="toc-h3 nav-item toc-entry"><a class="reference internal nav-link" href="#capstone-optimize-your-framework"><strong>🚀 Capstone: Optimize Your Framework</strong></a></li>
|
||
</ul>
|
||
</li>
|
||
<li class="toc-h2 nav-item toc-entry"><a class="reference internal nav-link" href="#choose-your-learning-path">🚀 <strong>Choose Your Learning Path</strong></a></li>
|
||
<li class="toc-h2 nav-item toc-entry"><a class="reference internal nav-link" href="#ready-to-start">🚀 <strong>Ready to Start?</strong></a><ul class="nav section-nav flex-column">
|
||
<li class="toc-h3 nav-item toc-entry"><a class="reference internal nav-link" href="#quick-taste-try-module-1-right-now"><strong>Quick Taste: Try Module 1 Right Now</strong></a></li>
|
||
</ul>
|
||
</li>
|
||
<li class="toc-h2 nav-item toc-entry"><a class="reference internal nav-link" href="#acknowledgments">🙏 <strong>Acknowledgments</strong></a></li>
|
||
</ul>
|
||
</nav>
|
||
</div>
|
||
</div>
|
||
</div>
|
||
|
||
|
||
|
||
<div id="searchbox"></div>
|
||
<article class="bd-article" role="main">
|
||
|
||
<section class="tex2jax_ignore mathjax_ignore" id="tinytorch-build-your-own-machine-learning-framework-from-scratch">
|
||
<h1>Tiny🔥Torch: Build your own Machine Learning framework from scratch.<a class="headerlink" href="#tinytorch-build-your-own-machine-learning-framework-from-scratch" title="Permalink to this heading">#</a></h1>
|
||
<p><strong>Most ML education teaches you to <em>use</em> frameworks. TinyTorch teaches you to <em>build</em> them.</strong></p>
|
||
<p>TinyTorch is a minimalist educational framework designed for learning by doing. Instead of relying on PyTorch or TensorFlow, you implement everything from scratch—tensors, autograd, optimizers, even MLOps tooling. This hands-on approach builds the deep systems intuition that sets ML engineers apart from ML users.</p>
|
||
<div class="tip admonition">
|
||
<p class="admonition-title">🎯 What You’ll Build</p>
|
||
<p><strong>A complete ML framework from scratch</strong>: your own PyTorch style toolkit that can:</p>
|
||
<ul class="simple">
|
||
<li><p>✅ Train neural networks on CIFAR-10 (real dataset!)</p></li>
|
||
<li><p>✅ Implement automatic differentiation (the “magic” behind PyTorch)</p></li>
|
||
<li><p>✅ Deploy production systems with 75% model compression</p></li>
|
||
<li><p>✅ Handle complete ML pipeline from data to monitoring</p></li>
|
||
</ul>
|
||
<p><strong>Result:</strong> You become the expert others ask about “how PyTorch actually works.”</p>
|
||
</div>
|
||
<p><em>Everyone wants to be an astronaut.</em> 🧑🚀 <em>TinyTorch teaches you how to build the rocket ship.</em> 🚀</p>
|
||
<hr class="docutils" />
|
||
<section id="the-core-difference">
|
||
<h2>💡 <strong>The Core Difference</strong><a class="headerlink" href="#the-core-difference" title="Permalink to this heading">#</a></h2>
|
||
<p>Most ML courses focus on algorithms and theory. You learn <em>what</em> neural networks do and <em>why</em> they work, but you import everything:</p>
|
||
<div class="highlight-python notranslate"><div class="highlight"><pre><span></span>Traditional ML Course: TinyTorch Approach:
|
||
├── import torch ├── class Tensor:
|
||
├── model = nn.Linear(10, 1) │ def __add__(self, other): ...
|
||
├── loss = nn.MSELoss() │ def backward(self): ...
|
||
└── optimizer.step() ├── class Linear:
|
||
│ def forward(self, x):
|
||
│ return x @ self.weight + self.bias
|
||
├── def mse_loss(pred, target):
|
||
│ return ((pred - target) ** 2).mean()
|
||
├── class SGD:
|
||
│ def step(self):
|
||
└── param.data -= lr * param.grad
|
||
|
||
Go from "How does this work?" 🤷 to "I implemented every line!" 💪
|
||
</pre></div>
|
||
</div>
|
||
<p>TinyTorch focuses on implementation and systems thinking. You learn <em>how</em> to build working systems with progressive scaffolding, production ready practices, and comprehensive course infrastructure that bridges the gap between learning and building.</p>
|
||
</section>
|
||
<hr class="docutils" />
|
||
<section id="learning-philosophy-build-use-master">
|
||
<h2>🎓 <strong>Learning Philosophy: Build, Use, Master</strong><a class="headerlink" href="#learning-philosophy-build-use-master" title="Permalink to this heading">#</a></h2>
|
||
<p>Every component follows the same powerful learning cycle:</p>
|
||
<section id="example-activation-functions">
|
||
<h3><strong>Example: Activation Functions</strong><a class="headerlink" href="#example-activation-functions" title="Permalink to this heading">#</a></h3>
|
||
<p><strong>🔧 Build:</strong> Implement ReLU from scratch</p>
|
||
<div class="highlight-python notranslate"><div class="highlight"><pre><span></span><span class="k">def</span> <span class="nf">relu</span><span class="p">(</span><span class="n">x</span><span class="p">):</span>
|
||
<span class="c1"># YOU implement this function</span>
|
||
<span class="k">return</span> <span class="n">np</span><span class="o">.</span><span class="n">maximum</span><span class="p">(</span><span class="mi">0</span><span class="p">,</span> <span class="n">x</span><span class="p">)</span> <span class="c1"># Your solution</span>
|
||
</pre></div>
|
||
</div>
|
||
<p><strong>🚀 Use:</strong> Immediately use your own code</p>
|
||
<div class="highlight-python notranslate"><div class="highlight"><pre><span></span><span class="kn">from</span> <span class="nn">tinytorch.core.activations</span> <span class="kn">import</span> <span class="n">ReLU</span> <span class="c1"># YOUR implementation!</span>
|
||
<span class="n">layer</span> <span class="o">=</span> <span class="n">ReLU</span><span class="p">()</span>
|
||
<span class="n">output</span> <span class="o">=</span> <span class="n">layer</span><span class="o">.</span><span class="n">forward</span><span class="p">(</span><span class="n">input_tensor</span><span class="p">)</span> <span class="c1"># Your code working!</span>
|
||
</pre></div>
|
||
</div>
|
||
<p><strong>💡 Master:</strong> See it working in real networks</p>
|
||
<div class="highlight-python notranslate"><div class="highlight"><pre><span></span><span class="c1"># Your ReLU is now part of a real neural network</span>
|
||
<span class="n">model</span> <span class="o">=</span> <span class="n">Sequential</span><span class="p">([</span>
|
||
<span class="n">Dense</span><span class="p">(</span><span class="mi">784</span><span class="p">,</span> <span class="mi">128</span><span class="p">),</span>
|
||
<span class="n">ReLU</span><span class="p">(),</span> <span class="c1"># <-- Your implementation</span>
|
||
<span class="n">Dense</span><span class="p">(</span><span class="mi">128</span><span class="p">,</span> <span class="mi">10</span><span class="p">)</span>
|
||
<span class="p">])</span>
|
||
</pre></div>
|
||
</div>
|
||
<p>This pattern repeats for every component: tensors, layers, optimizers, even MLOps systems. You build it, use it immediately, then see how it fits into larger systems.</p>
|
||
</section>
|
||
</section>
|
||
<hr class="docutils" />
|
||
<section id="course-journey-15-modules">
|
||
<h2>📚 <strong>Course Journey: 15 Modules</strong><a class="headerlink" href="#course-journey-15-modules" title="Permalink to this heading">#</a></h2>
|
||
<div class="note admonition">
|
||
<p class="admonition-title">🏗️ Foundation</p>
|
||
<p><strong>1. Setup</strong> • <strong>2. Tensors</strong> • <strong>3. Activations</strong></p>
|
||
<p>Understanding workflow, multi-dimensional arrays, and the mathematical functions that enable learning.</p>
|
||
</div>
|
||
<div class="note admonition">
|
||
<p class="admonition-title">🧱 Building Blocks</p>
|
||
<p><strong>4. Layers</strong> • <strong>5. Networks</strong> • <strong>6. CNNs</strong></p>
|
||
<p>Dense layers, sequential architecture, and convolutional operations for computer vision.</p>
|
||
</div>
|
||
<div class="note admonition">
|
||
<p class="admonition-title">🎯 Training Systems</p>
|
||
<p><strong>7. DataLoader</strong> • <strong>8. Autograd</strong> • <strong>9. Optimizers</strong> • <strong>10. Training</strong></p>
|
||
<p>CIFAR-10 loading, automatic differentiation, SGD/Adam optimizers, and complete training orchestration.</p>
|
||
</div>
|
||
<div class="note admonition">
|
||
<p class="admonition-title">⚡ Production & Performance</p>
|
||
<p><strong>11. Compression</strong> • <strong>12. Kernels</strong> • <strong>13. Benchmarking</strong> • <strong>14. MLOps</strong></p>
|
||
<p>Model optimization, high-performance operations, systematic evaluation, and production monitoring.</p>
|
||
</div>
|
||
<div class="note admonition">
|
||
<p class="admonition-title">🎓 Capstone Project</p>
|
||
<p><strong>15. Framework Optimization</strong></p>
|
||
<p>Choose your focus: performance engineering, algorithm extensions, systems optimization, framework analysis, or developer tools.</p>
|
||
</div>
|
||
</section>
|
||
<hr class="docutils" />
|
||
<section id="complete-system-integration">
|
||
<h2>🔗 <strong>Complete System Integration</strong><a class="headerlink" href="#complete-system-integration" title="Permalink to this heading">#</a></h2>
|
||
<p><strong>This isn’t 14 separate exercises.</strong> Every component you build integrates into one fully functional ML framework:</p>
|
||
<div class="important admonition">
|
||
<p class="admonition-title">🎯 How It All Connects</p>
|
||
<p><strong>Module 2: Your Tensor class</strong> → <strong>Module 3: Powers your activation functions</strong> → <strong>Module 4: Enables your layers</strong> → <strong>Module 5: Forms your networks</strong> → <strong>Module 8: Drives your autograd system</strong> → <strong>Module 9: Optimizes with your SGD/Adam</strong> → <strong>Module 10: Trains on real CIFAR-10 data</strong></p>
|
||
<p><strong>Result:</strong> A complete, working ML framework that you built from scratch, capable of training real neural networks on real datasets.</p>
|
||
</div>
|
||
<section id="capstone-optimize-your-framework">
|
||
<h3><strong>🚀 Capstone: Optimize Your Framework</strong><a class="headerlink" href="#capstone-optimize-your-framework" title="Permalink to this heading">#</a></h3>
|
||
<p>After completing the 14 core modules, you have a <strong>complete ML framework</strong>. Now make it better through systems engineering:</p>
|
||
<p><strong>Choose Your Focus:</strong></p>
|
||
<ul class="simple">
|
||
<li><p>⚡ <strong>Performance Optimization</strong>: GPU kernels, vectorization, memory-efficient operations</p></li>
|
||
<li><p>🧠 <strong>Algorithm Extensions</strong>: Transformer layers, BatchNorm, Dropout, advanced optimizers</p></li>
|
||
<li><p>🔧 <strong>Systems Engineering</strong>: Multi-GPU training, distributed computing, memory profiling</p></li>
|
||
<li><p>📊 <strong>Benchmarking Deep Dive</strong>: Compare your framework to PyTorch, identify bottlenecks</p></li>
|
||
<li><p>🛠️ <strong>Developer Experience</strong>: Better debugging tools, visualization, error messages</p></li>
|
||
</ul>
|
||
<p><strong>The Challenge:</strong> Use <strong>only your TinyTorch implementation</strong> as the base. No copying from PyTorch. This proves you understand the engineering trade-offs and can optimize real ML systems.</p>
|
||
</section>
|
||
</section>
|
||
<hr class="docutils" />
|
||
<section id="choose-your-learning-path">
|
||
<h2>🚀 <strong>Choose Your Learning Path</strong><a class="headerlink" href="#choose-your-learning-path" title="Permalink to this heading">#</a></h2>
|
||
<div class="important admonition">
|
||
<p class="admonition-title">Three Ways to Engage with TinyTorch</p>
|
||
<p class="rubric"><strong>🔬 <a class="reference internal" href="usage-paths/quick-exploration.html"><span class="doc std std-doc">Quick Exploration</span></a></strong> <em>(5 minutes)</em></p>
|
||
<p><em>“I want to see what this is about”</em></p>
|
||
<ul class="simple">
|
||
<li><p>Click and run code immediately in your browser (Binder)</p></li>
|
||
<li><p>No installation or setup required</p></li>
|
||
<li><p>Implement ReLU, tensors, neural networks interactively</p></li>
|
||
<li><p>Perfect for getting a feel for the course</p></li>
|
||
</ul>
|
||
<p class="rubric"><strong>🏗️ <a class="reference internal" href="usage-paths/serious-development.html"><span class="doc std std-doc">Serious Development</span></a></strong> <em>(8+ weeks)</em></p>
|
||
<p><em>“I want to build this myself”</em></p>
|
||
<ul class="simple">
|
||
<li><p>Fork the repo and work locally with full development environment</p></li>
|
||
<li><p>Build complete ML framework from scratch with <code class="docutils literal notranslate"><span class="pre">tito</span></code> CLI</p></li>
|
||
<li><p>14 progressive assignments from setup to production MLOps</p></li>
|
||
<li><p>Professional development workflow with automated testing</p></li>
|
||
</ul>
|
||
<p class="rubric"><strong>👨🏫 <a class="reference internal" href="usage-paths/classroom-use.html"><span class="doc std std-doc">Classroom Use</span></a></strong> <em>(Instructors)</em></p>
|
||
<p><em>“I want to teach this course”</em></p>
|
||
<ul class="simple">
|
||
<li><p>Complete course infrastructure with NBGrader integration</p></li>
|
||
<li><p>Automated grading for comprehensive testing</p></li>
|
||
<li><p>Flexible pacing (8-16 weeks) with proven pedagogical structure</p></li>
|
||
<li><p>Turn-key solution for ML systems education</p></li>
|
||
</ul>
|
||
</div>
|
||
</section>
|
||
<hr class="docutils" />
|
||
<section id="ready-to-start">
|
||
<h2>🚀 <strong>Ready to Start?</strong><a class="headerlink" href="#ready-to-start" title="Permalink to this heading">#</a></h2>
|
||
<section id="quick-taste-try-module-1-right-now">
|
||
<h3><strong>Quick Taste: Try Module 1 Right Now</strong><a class="headerlink" href="#quick-taste-try-module-1-right-now" title="Permalink to this heading">#</a></h3>
|
||
<p>Want to see what TinyTorch feels like? <strong><a class="reference internal" href="chapters/01-setup.html"><span class="doc std std-doc">Launch the Setup chapter</span></a></strong> in Binder and implement your first TinyTorch function in 2 minutes!</p>
|
||
</section>
|
||
</section>
|
||
<hr class="docutils" />
|
||
<section id="acknowledgments">
|
||
<h2>🙏 <strong>Acknowledgments</strong><a class="headerlink" href="#acknowledgments" title="Permalink to this heading">#</a></h2>
|
||
<p>TinyTorch originated from CS249r: Tiny Machine Learning Systems at Harvard University. We’re inspired by projects like <a class="reference external" href="https://github.com/geohot/tinygrad">tinygrad</a> and <a class="reference external" href="https://github.com/karpathy/micrograd">micrograd</a> that demonstrate the power of minimal implementations.</p>
|
||
<p><strong>Complementary Learning</strong>: For comprehensive ML systems knowledge, we recommend <a class="reference external" href="https://mlsysbook.ai"><strong>Machine Learning Systems</strong></a> by <a class="reference external" href="https://profvjreddi.github.io/website/">Prof. Vijay Janapa Reddi</a>. While TinyTorch teaches you to <strong>build</strong> ML systems from scratch, that book provides the broader <strong>systems context</strong> and engineering principles for production AI.</p>
|
||
</section>
|
||
<div class="toctree-wrapper compound">
|
||
</div>
|
||
<div class="toctree-wrapper compound">
|
||
</div>
|
||
<div class="toctree-wrapper compound">
|
||
</div>
|
||
<div class="toctree-wrapper compound">
|
||
</div>
|
||
<div class="toctree-wrapper compound">
|
||
</div>
|
||
<div class="toctree-wrapper compound">
|
||
</div>
|
||
<div class="toctree-wrapper compound">
|
||
</div>
|
||
</section>
|
||
|
||
<script type="text/x-thebe-config">
|
||
{
|
||
requestKernel: true,
|
||
binderOptions: {
|
||
repo: "binder-examples/jupyter-stacks-datascience",
|
||
ref: "master",
|
||
},
|
||
codeMirrorConfig: {
|
||
theme: "abcdef",
|
||
mode: "python"
|
||
},
|
||
kernelOptions: {
|
||
name: "python3",
|
||
path: "./."
|
||
},
|
||
predefinedOutput: true
|
||
}
|
||
</script>
|
||
<script>kernelName = 'python3'</script>
|
||
|
||
</article>
|
||
|
||
|
||
|
||
|
||
|
||
|
||
<footer class="prev-next-footer">
|
||
|
||
<div class="prev-next-area">
|
||
<a class="right-next"
|
||
href="usage-paths/quick-exploration.html"
|
||
title="next page">
|
||
<div class="prev-next-info">
|
||
<p class="prev-next-subtitle">next</p>
|
||
<p class="prev-next-title">🔬 Quick Exploration Path</p>
|
||
</div>
|
||
<i class="fa-solid fa-angle-right"></i>
|
||
</a>
|
||
</div>
|
||
</footer>
|
||
|
||
</div>
|
||
|
||
|
||
|
||
<div class="bd-sidebar-secondary bd-toc"><div class="sidebar-secondary-items sidebar-secondary__inner">
|
||
|
||
<div class="sidebar-secondary-item">
|
||
<div class="page-toc tocsection onthispage">
|
||
<i class="fa-solid fa-list"></i> Contents
|
||
</div>
|
||
<nav class="bd-toc-nav page-toc">
|
||
<ul class="visible nav section-nav flex-column">
|
||
<li class="toc-h2 nav-item toc-entry"><a class="reference internal nav-link" href="#the-core-difference">💡 <strong>The Core Difference</strong></a></li>
|
||
<li class="toc-h2 nav-item toc-entry"><a class="reference internal nav-link" href="#learning-philosophy-build-use-master">🎓 <strong>Learning Philosophy: Build, Use, Master</strong></a><ul class="nav section-nav flex-column">
|
||
<li class="toc-h3 nav-item toc-entry"><a class="reference internal nav-link" href="#example-activation-functions"><strong>Example: Activation Functions</strong></a></li>
|
||
</ul>
|
||
</li>
|
||
<li class="toc-h2 nav-item toc-entry"><a class="reference internal nav-link" href="#course-journey-15-modules">📚 <strong>Course Journey: 15 Modules</strong></a></li>
|
||
<li class="toc-h2 nav-item toc-entry"><a class="reference internal nav-link" href="#complete-system-integration">🔗 <strong>Complete System Integration</strong></a><ul class="nav section-nav flex-column">
|
||
<li class="toc-h3 nav-item toc-entry"><a class="reference internal nav-link" href="#capstone-optimize-your-framework"><strong>🚀 Capstone: Optimize Your Framework</strong></a></li>
|
||
</ul>
|
||
</li>
|
||
<li class="toc-h2 nav-item toc-entry"><a class="reference internal nav-link" href="#choose-your-learning-path">🚀 <strong>Choose Your Learning Path</strong></a></li>
|
||
<li class="toc-h2 nav-item toc-entry"><a class="reference internal nav-link" href="#ready-to-start">🚀 <strong>Ready to Start?</strong></a><ul class="nav section-nav flex-column">
|
||
<li class="toc-h3 nav-item toc-entry"><a class="reference internal nav-link" href="#quick-taste-try-module-1-right-now"><strong>Quick Taste: Try Module 1 Right Now</strong></a></li>
|
||
</ul>
|
||
</li>
|
||
<li class="toc-h2 nav-item toc-entry"><a class="reference internal nav-link" href="#acknowledgments">🙏 <strong>Acknowledgments</strong></a></li>
|
||
</ul>
|
||
</nav></div>
|
||
|
||
</div></div>
|
||
|
||
|
||
</div>
|
||
<footer class="bd-footer-content">
|
||
|
||
<div class="bd-footer-content__inner container">
|
||
|
||
<div class="footer-item">
|
||
|
||
<p class="component-author">
|
||
By Prof. Vijay Janapa Reddi (Harvard University)
|
||
</p>
|
||
|
||
</div>
|
||
|
||
<div class="footer-item">
|
||
|
||
|
||
<p class="copyright">
|
||
|
||
© Copyright 2022.
|
||
<br/>
|
||
|
||
</p>
|
||
|
||
</div>
|
||
|
||
<div class="footer-item">
|
||
|
||
</div>
|
||
|
||
<div class="footer-item">
|
||
|
||
</div>
|
||
|
||
</div>
|
||
</footer>
|
||
|
||
|
||
</main>
|
||
</div>
|
||
</div>
|
||
|
||
<!-- Scripts loaded after <body> so the DOM is not blocked -->
|
||
<script src="_static/scripts/bootstrap.js?digest=5b4479735964841361fd"></script>
|
||
<script src="_static/scripts/pydata-sphinx-theme.js?digest=5b4479735964841361fd"></script>
|
||
|
||
<footer class="bd-footer">
|
||
</footer>
|
||
</body>
|
||
</html> |