mirror of
https://github.com/MLSysBook/TinyTorch.git
synced 2026-05-23 18:46:06 -05:00
1673 lines
78 KiB
HTML
1673 lines
78 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="viewport" content="width=device-width, initial-scale=1" />
|
||
|
||
<title>Getting Started with TinyTorch — Tiny🔥Torch</title>
|
||
|
||
|
||
|
||
<script data-cfasync="false">
|
||
document.documentElement.dataset.mode = localStorage.getItem("mode") || "";
|
||
document.documentElement.dataset.theme = localStorage.getItem("theme") || "";
|
||
</script>
|
||
|
||
<!-- Loaded before other Sphinx assets -->
|
||
<link href="_static/styles/theme.css?digest=dfe6caa3a7d634c4db9b" rel="stylesheet" />
|
||
<link href="_static/styles/bootstrap.css?digest=dfe6caa3a7d634c4db9b" rel="stylesheet" />
|
||
<link href="_static/styles/pydata-sphinx-theme.css?digest=dfe6caa3a7d634c4db9b" rel="stylesheet" />
|
||
|
||
|
||
<link href="_static/vendor/fontawesome/6.5.2/css/all.min.css?digest=dfe6caa3a7d634c4db9b" rel="stylesheet" />
|
||
<link rel="preload" as="font" type="font/woff2" crossorigin href="_static/vendor/fontawesome/6.5.2/webfonts/fa-solid-900.woff2" />
|
||
<link rel="preload" as="font" type="font/woff2" crossorigin href="_static/vendor/fontawesome/6.5.2/webfonts/fa-brands-400.woff2" />
|
||
<link rel="preload" as="font" type="font/woff2" crossorigin href="_static/vendor/fontawesome/6.5.2/webfonts/fa-regular-400.woff2" />
|
||
|
||
<link rel="stylesheet" type="text/css" href="_static/pygments.css?v=03e43079" />
|
||
<link rel="stylesheet" type="text/css" href="_static/styles/sphinx-book-theme.css?v=eba8b062" />
|
||
<link rel="stylesheet" type="text/css" href="_static/togglebutton.css?v=13237357" />
|
||
<link rel="stylesheet" type="text/css" href="_static/copybutton.css?v=76b2166b" />
|
||
<link rel="stylesheet" type="text/css" href="_static/mystnb.8ecb98da25f57f5357bf6f572d296f466b2cfe2517ffebfabe82451661e28f02.css" />
|
||
<link rel="stylesheet" type="text/css" href="_static/sphinx-thebe.css?v=4fa983c6" />
|
||
<link rel="stylesheet" type="text/css" href="_static/sphinx-design.min.css?v=95c83b7e" />
|
||
<link rel="stylesheet" type="text/css" href="_static/custom.css?v=009d37f4" />
|
||
|
||
<!-- Pre-loaded scripts that we'll load fully later -->
|
||
<link rel="preload" as="script" href="_static/scripts/bootstrap.js?digest=dfe6caa3a7d634c4db9b" />
|
||
<link rel="preload" as="script" href="_static/scripts/pydata-sphinx-theme.js?digest=dfe6caa3a7d634c4db9b" />
|
||
<script src="_static/vendor/fontawesome/6.5.2/js/all.min.js?digest=dfe6caa3a7d634c4db9b"></script>
|
||
|
||
<script src="_static/documentation_options.js?v=9eb32ce0"></script>
|
||
<script src="_static/doctools.js?v=9a2dae69"></script>
|
||
<script src="_static/sphinx_highlight.js?v=dc90522c"></script>
|
||
<script src="_static/clipboard.min.js?v=a7894cd8"></script>
|
||
<script src="_static/copybutton.js?v=f281be69"></script>
|
||
<script src="_static/scripts/sphinx-book-theme.js?v=887ef09a"></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?v=4a39c7ea"></script>
|
||
<script>var togglebuttonSelector = '.toggle, .admonition.dropdown';</script>
|
||
<script src="_static/design-tabs.js?v=f930bc37"></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?v=c100c467"></script>
|
||
<script>var togglebuttonSelector = '.toggle, .admonition.dropdown';</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 type="module" src="https://cdn.jsdelivr.net/npm/mermaid@10.6.1/dist/mermaid.esm.min.mjs"></script>
|
||
<script type="module" src="https://cdn.jsdelivr.net/npm/@mermaid-js/layout-elk@0.2.0/dist/mermaid-layout-elk.esm.min.mjs"></script>
|
||
<script type="module">import mermaid from "https://cdn.jsdelivr.net/npm/mermaid@10.6.1/dist/mermaid.esm.min.mjs";import elkLayouts from "https://cdn.jsdelivr.net/npm/@mermaid-js/layout-elk@0.2.0/dist/mermaid-layout-elk.esm.min.mjs";mermaid.registerLayoutLoaders(elkLayouts);mermaid.initialize({startOnLoad:false});</script>
|
||
<script src="https://cdn.jsdelivr.net/npm/d3@7.9.0/dist/d3.min.js"></script>
|
||
<script type="module">import mermaid from "https://cdn.jsdelivr.net/npm/mermaid@10.6.1/dist/mermaid.esm.min.mjs";
|
||
|
||
const defaultStyle = document.createElement('style');
|
||
defaultStyle.textContent = `pre.mermaid {
|
||
/* Same as .mermaid-container > pre */
|
||
display: block;
|
||
width: 100%;
|
||
}
|
||
|
||
pre.mermaid > svg {
|
||
/* Same as .mermaid-container > pre > svg */
|
||
height: 500px;
|
||
width: 100%;
|
||
max-width: 100% !important;
|
||
}
|
||
`;
|
||
document.head.appendChild(defaultStyle);
|
||
|
||
const fullscreenStyle = document.createElement('style');
|
||
fullscreenStyle.textContent = `.mermaid-container {
|
||
display: flex;
|
||
flex-direction: row;
|
||
width: 100%;
|
||
}
|
||
|
||
.mermaid-container > pre {
|
||
display: block;
|
||
width: 100%;
|
||
}
|
||
|
||
.mermaid-container > pre > svg {
|
||
height: 500px;
|
||
width: 100%;
|
||
max-width: 100% !important;
|
||
}
|
||
|
||
.mermaid-fullscreen-btn {
|
||
width: 28px;
|
||
height: 28px;
|
||
background: rgba(255, 255, 255, 0.95);
|
||
border: 1px solid rgba(0, 0, 0, 0.3);
|
||
border-radius: 4px;
|
||
cursor: pointer;
|
||
display: flex;
|
||
align-items: center;
|
||
justify-content: center;
|
||
transition: all 0.2s;
|
||
box-shadow: 0 2px 6px rgba(0, 0, 0, 0.2);
|
||
font-size: 14px;
|
||
line-height: 1;
|
||
padding: 0;
|
||
color: #333;
|
||
}
|
||
|
||
.mermaid-fullscreen-btn:hover {
|
||
opacity: 100% !important;
|
||
background: rgba(255, 255, 255, 1);
|
||
box-shadow: 0 3px 10px rgba(0, 0, 0, 0.3);
|
||
transform: scale(1.1);
|
||
}
|
||
|
||
.mermaid-fullscreen-btn.dark-theme {
|
||
background: rgba(50, 50, 50, 0.95);
|
||
border: 1px solid rgba(255, 255, 255, 0.3);
|
||
color: #e0e0e0;
|
||
}
|
||
|
||
.mermaid-fullscreen-btn.dark-theme:hover {
|
||
background: rgba(60, 60, 60, 1);
|
||
box-shadow: 0 3px 10px rgba(255, 255, 255, 0.2);
|
||
}
|
||
|
||
.mermaid-fullscreen-modal {
|
||
display: none;
|
||
position: fixed !important;
|
||
top: 0 !important;
|
||
left: 0 !important;
|
||
width: 95vw;
|
||
height: 100vh;
|
||
background: rgba(255, 255, 255, 0.98);
|
||
z-index: 9999;
|
||
padding: 20px;
|
||
overflow: auto;
|
||
}
|
||
|
||
.mermaid-fullscreen-modal.dark-theme {
|
||
background: rgba(0, 0, 0, 0.98);
|
||
}
|
||
|
||
.mermaid-fullscreen-modal.active {
|
||
display: flex;
|
||
align-items: center;
|
||
justify-content: center;
|
||
}
|
||
|
||
.mermaid-container-fullscreen {
|
||
position: relative;
|
||
width: 95vw;
|
||
height: 90vh;
|
||
max-width: 95vw;
|
||
max-height: 90vh;
|
||
background: white;
|
||
border-radius: 8px;
|
||
padding: 20px;
|
||
box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3);
|
||
overflow: auto;
|
||
display: flex;
|
||
align-items: center;
|
||
justify-content: center;
|
||
}
|
||
|
||
.mermaid-container-fullscreen.dark-theme {
|
||
background: #1a1a1a;
|
||
box-shadow: 0 10px 40px rgba(0, 0, 0, 0.8);
|
||
}
|
||
|
||
.mermaid-container-fullscreen pre.mermaid {
|
||
width: 100%;
|
||
height: 100%;
|
||
display: flex;
|
||
align-items: center;
|
||
justify-content: center;
|
||
}
|
||
|
||
.mermaid-container-fullscreen .mermaid svg {
|
||
height: 100% !important;
|
||
width: 100% !important;
|
||
cursor: grab;
|
||
}
|
||
|
||
.mermaid-fullscreen-close {
|
||
position: fixed !important;
|
||
top: 20px !important;
|
||
right: 20px !important;
|
||
width: 40px;
|
||
height: 40px;
|
||
background: rgba(255, 255, 255, 0.95);
|
||
border: 1px solid rgba(0, 0, 0, 0.2);
|
||
border-radius: 50%;
|
||
cursor: pointer;
|
||
z-index: 10000;
|
||
display: flex;
|
||
align-items: center;
|
||
justify-content: center;
|
||
box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
|
||
transition: all 0.2s;
|
||
font-size: 24px;
|
||
line-height: 1;
|
||
color: #333;
|
||
}
|
||
|
||
.mermaid-fullscreen-close:hover {
|
||
background: white;
|
||
box-shadow: 0 6px 16px rgba(0, 0, 0, 0.4);
|
||
transform: scale(1.1);
|
||
}
|
||
|
||
.mermaid-fullscreen-close.dark-theme {
|
||
background: rgba(50, 50, 50, 0.95);
|
||
border: 1px solid rgba(255, 255, 255, 0.2);
|
||
color: #e0e0e0;
|
||
}
|
||
|
||
.mermaid-fullscreen-close.dark-theme:hover {
|
||
background: rgba(60, 60, 60, 1);
|
||
box-shadow: 0 6px 16px rgba(255, 255, 255, 0.2);
|
||
}
|
||
|
||
.mermaid-fullscreen-modal .mermaid-fullscreen-btn {
|
||
display: none !important;
|
||
}`;
|
||
document.head.appendChild(fullscreenStyle);
|
||
|
||
// Detect if page has dark background
|
||
const isDarkTheme = () => {
|
||
const bgColor = window.getComputedStyle(document.body).backgroundColor;
|
||
const match = bgColor.match(/rgb\((\d+),\s*(\d+),\s*(\d+)/);
|
||
if (match) {
|
||
const r = parseInt(match[1]);
|
||
const g = parseInt(match[2]);
|
||
const b = parseInt(match[3]);
|
||
const brightness = (r * 299 + g * 587 + b * 114) / 1000;
|
||
return brightness < 128;
|
||
}
|
||
return false;
|
||
};
|
||
|
||
const load = async () => {
|
||
await mermaid.run();
|
||
|
||
const all_mermaids = document.querySelectorAll(".mermaid");
|
||
const mermaids_processed = document.querySelectorAll(".mermaid[data-processed='true']");
|
||
|
||
if ("False" === "True") {
|
||
const mermaids_to_add_zoom = -1 === -1 ? all_mermaids.length : -1;
|
||
if(mermaids_to_add_zoom > 0) {
|
||
var svgs = d3.selectAll("");
|
||
if(all_mermaids.length !== mermaids_processed.length) {
|
||
setTimeout(load, 200);
|
||
return;
|
||
} else if(svgs.size() !== mermaids_to_add_zoom) {
|
||
setTimeout(load, 200);
|
||
return;
|
||
} else {
|
||
svgs.each(function() {
|
||
var svg = d3.select(this);
|
||
svg.html("<g class='wrapper'>" + svg.html() + "</g>");
|
||
var inner = svg.select("g");
|
||
var zoom = d3.zoom().on("zoom", function(event) {
|
||
inner.attr("transform", event.transform);
|
||
});
|
||
svg.call(zoom);
|
||
});
|
||
}
|
||
}
|
||
} else if(all_mermaids.length !== mermaids_processed.length) {
|
||
// Wait for mermaid to process all diagrams
|
||
setTimeout(load, 200);
|
||
return;
|
||
}
|
||
|
||
const darkTheme = isDarkTheme();
|
||
|
||
// Stop here if not adding fullscreen capability
|
||
if ("True" !== "True") return;
|
||
|
||
const modal = document.createElement('div');
|
||
modal.className = 'mermaid-fullscreen-modal' + (darkTheme ? ' dark-theme' : '');
|
||
modal.setAttribute('role', 'dialog');
|
||
modal.setAttribute('aria-modal', 'true');
|
||
modal.setAttribute('aria-label', 'Fullscreen diagram viewer');
|
||
modal.innerHTML = `
|
||
<button class="mermaid-fullscreen-close${darkTheme ? ' dark-theme' : ''}" aria-label="Close fullscreen">✕</button>
|
||
<div class="mermaid-container-fullscreen${darkTheme ? ' dark-theme' : ''}"></div>
|
||
`;
|
||
document.body.appendChild(modal);
|
||
|
||
const modalContent = modal.querySelector('.mermaid-container-fullscreen');
|
||
const closeBtn = modal.querySelector('.mermaid-fullscreen-close');
|
||
|
||
let previousScrollOffset = [window.scrollX, window.scrollY];
|
||
|
||
const closeModal = () => {
|
||
modal.classList.remove('active');
|
||
modalContent.innerHTML = '';
|
||
document.body.style.overflow = ''
|
||
window.scrollTo({left: previousScrollOffset[0], top: previousScrollOffset[1], behavior: 'instant'});
|
||
};
|
||
|
||
closeBtn.addEventListener('click', closeModal);
|
||
modal.addEventListener('click', (e) => {
|
||
if (e.target === modal) closeModal();
|
||
});
|
||
document.addEventListener('keydown', (e) => {
|
||
if (e.key === 'Escape' && modal.classList.contains('active')) {
|
||
closeModal();
|
||
}
|
||
});
|
||
|
||
const allButtons = [];
|
||
|
||
document.querySelectorAll('.mermaid').forEach((mermaidDiv) => {
|
||
if (mermaidDiv.parentNode.classList.contains('mermaid-container') ||
|
||
mermaidDiv.closest('.mermaid-fullscreen-modal')) {
|
||
return;
|
||
}
|
||
|
||
const container = document.createElement('div');
|
||
container.className = 'mermaid-container';
|
||
mermaidDiv.parentNode.insertBefore(container, mermaidDiv);
|
||
container.appendChild(mermaidDiv);
|
||
|
||
const fullscreenBtn = document.createElement('button');
|
||
fullscreenBtn.className = 'mermaid-fullscreen-btn' + (darkTheme ? ' dark-theme' : '');
|
||
fullscreenBtn.setAttribute('aria-label', 'View diagram in fullscreen');
|
||
fullscreenBtn.textContent = '⛶';
|
||
fullscreenBtn.style.opacity = '50%';
|
||
|
||
// Calculate dynamic position based on diagram's margin and padding
|
||
const diagramStyle = window.getComputedStyle(mermaidDiv);
|
||
const marginTop = parseFloat(diagramStyle.marginTop) || 0;
|
||
const marginRight = parseFloat(diagramStyle.marginRight) || 0;
|
||
const paddingTop = parseFloat(diagramStyle.paddingTop) || 0;
|
||
const paddingRight = parseFloat(diagramStyle.paddingRight) || 0;
|
||
fullscreenBtn.style.top = `${marginTop + paddingTop + 4}px`;
|
||
fullscreenBtn.style.right = `${marginRight + paddingRight + 4}px`;
|
||
|
||
fullscreenBtn.addEventListener('click', () => {
|
||
previousScrollOffset = [window.scroll, window.scrollY];
|
||
const clone = mermaidDiv.cloneNode(true);
|
||
modalContent.innerHTML = '';
|
||
modalContent.appendChild(clone);
|
||
|
||
const svg = clone.querySelector('svg');
|
||
if (svg) {
|
||
svg.removeAttribute('width');
|
||
svg.removeAttribute('height');
|
||
svg.style.width = '100%';
|
||
svg.style.height = 'auto';
|
||
svg.style.maxWidth = '100%';
|
||
svg.style.sdisplay = 'block';
|
||
|
||
if ("False" === "True") {
|
||
setTimeout(() => {
|
||
const g = svg.querySelector('g');
|
||
if (g) {
|
||
var svgD3 = d3.select(svg);
|
||
svgD3.html("<g class='wrapper'>" + svgD3.html() + "</g>");
|
||
var inner = svgD3.select("g");
|
||
var zoom = d3.zoom().on("zoom", function(event) {
|
||
inner.attr("transform", event.transform);
|
||
});
|
||
svgD3.call(zoom);
|
||
}
|
||
}, 100);
|
||
}
|
||
}
|
||
|
||
modal.classList.add('active');
|
||
document.body.style.overflow = 'hidden';
|
||
});
|
||
|
||
container.appendChild(fullscreenBtn);
|
||
allButtons.push(fullscreenBtn);
|
||
});
|
||
|
||
// Update theme classes when theme changes
|
||
const updateTheme = () => {
|
||
const dark = isDarkTheme();
|
||
allButtons.forEach(btn => {
|
||
if (dark) {
|
||
btn.classList.add('dark-theme');
|
||
} else {
|
||
btn.classList.remove('dark-theme');
|
||
}
|
||
});
|
||
if (dark) {
|
||
modal.classList.add('dark-theme');
|
||
modalContent.classList.add('dark-theme');
|
||
closeBtn.classList.add('dark-theme');
|
||
} else {
|
||
modal.classList.remove('dark-theme');
|
||
modalContent.classList.remove('dark-theme');
|
||
closeBtn.classList.remove('dark-theme');
|
||
}
|
||
};
|
||
|
||
// Watch for theme changes
|
||
const observer = new MutationObserver(updateTheme);
|
||
observer.observe(document.documentElement, {
|
||
attributes: true,
|
||
attributeFilter: ['class', 'style', 'data-theme']
|
||
});
|
||
observer.observe(document.body, {
|
||
attributes: true,
|
||
attributeFilter: ['class', 'style']
|
||
});
|
||
};
|
||
|
||
window.addEventListener("load", load);
|
||
</script>
|
||
<script>DOCUMENTATION_OPTIONS.pagename = 'getting-started';</script>
|
||
<script src="_static/ml-timeline.js?v=76e9b3e3"></script>
|
||
<script src="_static/wip-banner.js?v=04a7e74d"></script>
|
||
<script src="_static/marimo-badges.js?v=e6289128"></script>
|
||
<script src="_static/sidebar-link.js?v=404b701b"></script>
|
||
<script src="_static/hero-carousel.js?v=10341d2a"></script>
|
||
<script src="_static/subscribe-modal.js?v=42919b64"></script>
|
||
<link rel="icon" href="_static/favicon.svg"/>
|
||
<link rel="index" title="Index" href="genindex.html" />
|
||
<link rel="search" title="Search" href="search.html" />
|
||
<link rel="next" title="🏗 Foundation Tier (Modules 01-07)" href="tiers/foundation.html" />
|
||
<link rel="prev" title="Getting Started" href="intro.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="">
|
||
|
||
|
||
|
||
<div id="pst-skip-link" class="skip-link d-print-none"><a href="#main-content">Skip to main content</a></div>
|
||
|
||
<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"
|
||
id="pst-primary-sidebar-checkbox"/>
|
||
<label class="overlay overlay-primary" for="pst-primary-sidebar-checkbox"></label>
|
||
|
||
<input type="checkbox"
|
||
class="sidebar-toggle"
|
||
id="pst-secondary-sidebar-checkbox"/>
|
||
<label class="overlay overlay-secondary" for="pst-secondary-sidebar-checkbox"></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..."
|
||
aria-label="Search..."
|
||
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>
|
||
|
||
<div class="pst-async-banner-revealer d-none">
|
||
<aside id="bd-header-version-warning" class="d-none d-print-none" aria-label="Version warning"></aside>
|
||
</div>
|
||
|
||
|
||
<header class="bd-header navbar navbar-expand-lg bd-navbar d-print-none">
|
||
</header>
|
||
|
||
|
||
<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="intro.html">
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
<img src="_static/logo-tinytorch.png" class="logo__image only-light" alt="Tiny🔥Torch - Home"/>
|
||
<script>document.write(`<img src="_static/logo-tinytorch.png" class="logo__image only-dark" alt="Tiny🔥Torch - Home"/>`);</script>
|
||
|
||
|
||
</a></div>
|
||
<div class="sidebar-primary-item">
|
||
|
||
<script>
|
||
document.write(`
|
||
<button class="btn search-button-field search-button__button" title="Search" aria-label="Search" data-bs-placement="bottom" data-bs-toggle="tooltip">
|
||
<i class="fa-solid fa-magnifying-glass"></i>
|
||
<span class="search-button__default-text">Search</span>
|
||
<span class="search-button__kbd-shortcut"><kbd class="kbd-shortcut__modifier">Ctrl</kbd>+<kbd class="kbd-shortcut__modifier">K</kbd></span>
|
||
</button>
|
||
`);
|
||
</script></div>
|
||
<div class="sidebar-primary-item"><nav class="bd-links bd-docs-nav" aria-label="Main">
|
||
<div class="bd-toc-item navbar-nav active">
|
||
<p aria-level="2" class="caption" role="heading"><span class="caption-text">🚀 Getting Started</span></p>
|
||
<ul class="current nav bd-sidenav">
|
||
<li class="toctree-l1 current active"><a class="current reference internal" href="#">Complete Guide</a></li>
|
||
</ul>
|
||
<p aria-level="2" class="caption" role="heading"><span class="caption-text">🏗 Foundation Tier (01-07)</span></p>
|
||
<ul class="nav bd-sidenav">
|
||
<li class="toctree-l1"><a class="reference internal" href="tiers/foundation.html">📖 Tier Overview</a></li>
|
||
<li class="toctree-l1"><a class="reference internal" href="modules/01_tensor_ABOUT.html">01. Tensor</a></li>
|
||
<li class="toctree-l1"><a class="reference internal" href="modules/02_activations_ABOUT.html">02. Activations</a></li>
|
||
<li class="toctree-l1"><a class="reference internal" href="modules/03_layers_ABOUT.html">03. Layers</a></li>
|
||
<li class="toctree-l1"><a class="reference internal" href="modules/04_losses_ABOUT.html">04. Losses</a></li>
|
||
<li class="toctree-l1"><a class="reference internal" href="modules/05_autograd_ABOUT.html">05. Autograd</a></li>
|
||
<li class="toctree-l1"><a class="reference internal" href="modules/06_optimizers_ABOUT.html">06. Optimizers</a></li>
|
||
<li class="toctree-l1"><a class="reference internal" href="modules/07_training_ABOUT.html">07. Training</a></li>
|
||
</ul>
|
||
<p aria-level="2" class="caption" role="heading"><span class="caption-text">🏛️ Architecture Tier (08-13)</span></p>
|
||
<ul class="nav bd-sidenav">
|
||
<li class="toctree-l1"><a class="reference internal" href="tiers/architecture.html">📖 Tier Overview</a></li>
|
||
<li class="toctree-l1"><a class="reference internal" href="modules/08_dataloader_ABOUT.html">08. DataLoader</a></li>
|
||
<li class="toctree-l1"><a class="reference internal" href="modules/09_spatial_ABOUT.html">09. Convolutions</a></li>
|
||
<li class="toctree-l1"><a class="reference internal" href="modules/10_tokenization_ABOUT.html">10. Tokenization</a></li>
|
||
<li class="toctree-l1"><a class="reference internal" href="modules/11_embeddings_ABOUT.html">11. Embeddings</a></li>
|
||
<li class="toctree-l1"><a class="reference internal" href="modules/12_attention_ABOUT.html">12. Attention</a></li>
|
||
<li class="toctree-l1"><a class="reference internal" href="modules/13_transformers_ABOUT.html">13. Transformers</a></li>
|
||
</ul>
|
||
<p aria-level="2" class="caption" role="heading"><span class="caption-text">⏱️ Optimization Tier (14-19)</span></p>
|
||
<ul class="nav bd-sidenav">
|
||
<li class="toctree-l1"><a class="reference internal" href="tiers/optimization.html">📖 Tier Overview</a></li>
|
||
<li class="toctree-l1"><a class="reference internal" href="modules/14_profiling_ABOUT.html">14. Profiling</a></li>
|
||
<li class="toctree-l1"><a class="reference internal" href="modules/15_quantization_ABOUT.html">15. Quantization</a></li>
|
||
<li class="toctree-l1"><a class="reference internal" href="modules/16_compression_ABOUT.html">16. Compression</a></li>
|
||
<li class="toctree-l1"><a class="reference internal" href="modules/17_memoization_ABOUT.html">17. Memoization</a></li>
|
||
<li class="toctree-l1"><a class="reference internal" href="modules/18_acceleration_ABOUT.html">18. Acceleration</a></li>
|
||
<li class="toctree-l1"><a class="reference internal" href="modules/19_benchmarking_ABOUT.html">19. Benchmarking</a></li>
|
||
</ul>
|
||
<p aria-level="2" class="caption" role="heading"><span class="caption-text">🏅 Capstone Competition</span></p>
|
||
<ul class="nav bd-sidenav">
|
||
<li class="toctree-l1"><a class="reference internal" href="tiers/olympics.html">📖 Competition Overview</a></li>
|
||
<li class="toctree-l1"><a class="reference internal" href="modules/20_capstone_ABOUT.html">20. Torch Olympics</a></li>
|
||
</ul>
|
||
<p aria-level="2" class="caption" role="heading"><span class="caption-text">🧭 Course Orientation</span></p>
|
||
<ul class="nav bd-sidenav">
|
||
<li class="toctree-l1"><a class="reference internal" href="chapters/00-introduction.html">Course Structure</a></li>
|
||
<li class="toctree-l1"><a class="reference internal" href="prerequisites.html">Prerequisites & Resources</a></li>
|
||
<li class="toctree-l1"><a class="reference internal" href="chapters/learning-journey.html">Learning Journey</a></li>
|
||
<li class="toctree-l1"><a class="reference internal" href="chapters/milestones.html">Historical Milestones</a></li>
|
||
<li class="toctree-l1"><a class="reference internal" href="faq.html">FAQ</a></li>
|
||
</ul>
|
||
<p aria-level="2" class="caption" role="heading"><span class="caption-text">🛠️ TITO CLI Reference</span></p>
|
||
<ul class="nav bd-sidenav">
|
||
<li class="toctree-l1"><a class="reference internal" href="tito/overview.html">Command Overview</a></li>
|
||
<li class="toctree-l1"><a class="reference internal" href="tito/modules.html">Module Workflow</a></li>
|
||
<li class="toctree-l1"><a class="reference internal" href="tito/milestones.html">Milestone System</a></li>
|
||
<li class="toctree-l1"><a class="reference internal" href="tito/data.html">Progress & Data</a></li>
|
||
<li class="toctree-l1"><a class="reference internal" href="tito/troubleshooting.html">Troubleshooting</a></li>
|
||
<li class="toctree-l1"><a class="reference internal" href="datasets.html">Datasets Guide</a></li>
|
||
</ul>
|
||
<p aria-level="2" class="caption" role="heading"><span class="caption-text">🤝 Community</span></p>
|
||
<ul class="nav bd-sidenav">
|
||
<li class="toctree-l1"><a class="reference internal" href="community.html">Ecosystem</a></li>
|
||
<li class="toctree-l1"><a class="reference internal" href="resources.html">Learning Resources</a></li>
|
||
<li class="toctree-l1"><a class="reference internal" href="credits.html">Credits & Acknowledgments</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" role="main">
|
||
|
||
|
||
|
||
<div class="sbt-scroll-pixel-helper"></div>
|
||
|
||
<div class="bd-content">
|
||
<div class="bd-article-container">
|
||
|
||
<div class="bd-header-article d-print-none">
|
||
<div class="header-article-items header-article__inner">
|
||
|
||
<div class="header-article-items__start">
|
||
|
||
<div class="header-article-item"><button class="sidebar-toggle primary-toggle btn btn-sm" title="Toggle primary sidebar" data-bs-placement="bottom" data-bs-toggle="tooltip">
|
||
<span class="fa-solid fa-bars"></span>
|
||
</button></div>
|
||
|
||
</div>
|
||
|
||
|
||
<div class="header-article-items__end">
|
||
|
||
<div class="header-article-item">
|
||
|
||
<div class="article-header-buttons">
|
||
|
||
|
||
|
||
|
||
|
||
<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/getting-started.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 nav-link pst-navbar-icon theme-switch-button" title="light/dark" aria-label="light/dark" data-bs-placement="bottom" data-bs-toggle="tooltip">
|
||
<i class="theme-switch fa-solid fa-sun fa-lg" data-mode="light"></i>
|
||
<i class="theme-switch fa-solid fa-moon fa-lg" data-mode="dark"></i>
|
||
<i class="theme-switch fa-solid fa-circle-half-stroke fa-lg" data-mode="auto"></i>
|
||
</button>
|
||
`);
|
||
</script>
|
||
|
||
|
||
<script>
|
||
document.write(`
|
||
<button class="btn btn-sm pst-navbar-icon 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>
|
||
<button class="sidebar-toggle secondary-toggle btn btn-sm" title="Toggle secondary sidebar" data-bs-placement="bottom" data-bs-toggle="tooltip">
|
||
<span class="fa-solid fa-list"></span>
|
||
</button>
|
||
</div></div>
|
||
|
||
</div>
|
||
|
||
</div>
|
||
</div>
|
||
|
||
|
||
|
||
<div id="jb-print-docs-body" class="onlyprint">
|
||
<h1>Getting Started with TinyTorch</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="#for-students-build-your-ml-framework">🎓 For Students: Build Your ML Framework</a><ul class="nav section-nav flex-column">
|
||
<li class="toc-h3 nav-item toc-entry"><a class="reference internal nav-link" href="#quick-setup-2-minutes">Quick Setup (2 Minutes)</a></li>
|
||
<li class="toc-h3 nav-item toc-entry"><a class="reference internal nav-link" href="#join-the-community-optional">Join the Community (Optional)</a></li>
|
||
<li class="toc-h3 nav-item toc-entry"><a class="reference internal nav-link" href="#the-tinytorch-build-cycle">The TinyTorch Build Cycle</a><ul class="nav section-nav flex-column">
|
||
<li class="toc-h4 nav-item toc-entry"><a class="reference internal nav-link" href="#step-1-edit-modules">Step 1: Edit Modules</a></li>
|
||
<li class="toc-h4 nav-item toc-entry"><a class="reference internal nav-link" href="#step-2-export-to-package">Step 2: Export to Package</a></li>
|
||
<li class="toc-h4 nav-item toc-entry"><a class="reference internal nav-link" href="#step-3-validate-with-milestones">Step 3: Validate with Milestones</a></li>
|
||
</ul>
|
||
</li>
|
||
<li class="toc-h3 nav-item toc-entry"><a class="reference internal nav-link" href="#your-first-module-15-minutes">Your First Module (15 Minutes)</a></li>
|
||
<li class="toc-h3 nav-item toc-entry"><a class="reference internal nav-link" href="#module-progression">Module Progression</a></li>
|
||
<li class="toc-h3 nav-item toc-entry"><a class="reference internal nav-link" href="#essential-commands-reference">Essential Commands Reference</a></li>
|
||
<li class="toc-h3 nav-item toc-entry"><a class="reference internal nav-link" href="#notebook-platform-options">Notebook Platform Options</a></li>
|
||
<li class="toc-h3 nav-item toc-entry"><a class="reference internal nav-link" href="#whats-next">What’s Next?</a></li>
|
||
</ul>
|
||
</li>
|
||
<li class="toc-h2 nav-item toc-entry"><a class="reference internal nav-link" href="#for-instructors-turn-key-ml-systems-course">👨🏫 For Instructors: Turn-Key ML Systems Course</a><ul class="nav section-nav flex-column">
|
||
<li class="toc-h3 nav-item toc-entry"><a class="reference internal nav-link" href="#course-overview">Course Overview</a></li>
|
||
<li class="toc-h3 nav-item toc-entry"><a class="reference internal nav-link" href="#minute-instructor-setup">30-Minute Instructor Setup</a></li>
|
||
<li class="toc-h3 nav-item toc-entry"><a class="reference internal nav-link" href="#assignment-workflow">Assignment Workflow</a></li>
|
||
<li class="toc-h3 nav-item toc-entry"><a class="reference internal nav-link" href="#grading-components">Grading Components</a></li>
|
||
<li class="toc-h3 nav-item toc-entry"><a class="reference internal nav-link" href="#grading-rubric-for-ml-systems-questions">Grading Rubric for ML Systems Questions</a></li>
|
||
<li class="toc-h3 nav-item toc-entry"><a class="reference internal nav-link" href="#module-teaching-notes">Module Teaching Notes</a></li>
|
||
<li class="toc-h3 nav-item toc-entry"><a class="reference internal nav-link" href="#sample-schedule-16-weeks">Sample Schedule (16 Weeks)</a></li>
|
||
<li class="toc-h3 nav-item toc-entry"><a class="reference internal nav-link" href="#assessment-strategy">Assessment Strategy</a></li>
|
||
<li class="toc-h3 nav-item toc-entry"><a class="reference internal nav-link" href="#instructor-resources">Instructor Resources</a></li>
|
||
</ul>
|
||
</li>
|
||
<li class="toc-h2 nav-item toc-entry"><a class="reference internal nav-link" href="#for-teaching-assistants-student-support-guide">👥 For Teaching Assistants: Student Support Guide</a><ul class="nav section-nav flex-column">
|
||
<li class="toc-h3 nav-item toc-entry"><a class="reference internal nav-link" href="#ta-preparation">TA Preparation</a></li>
|
||
<li class="toc-h3 nav-item toc-entry"><a class="reference internal nav-link" href="#common-student-errors">Common Student Errors</a><ul class="nav section-nav flex-column">
|
||
<li class="toc-h4 nav-item toc-entry"><a class="reference internal nav-link" href="#module-05-autograd">Module 05: Autograd</a></li>
|
||
<li class="toc-h4 nav-item toc-entry"><a class="reference internal nav-link" href="#module-09-cnns-spatial">Module 09: CNNs (Spatial)</a></li>
|
||
<li class="toc-h4 nav-item toc-entry"><a class="reference internal nav-link" href="#module-13-transformers">Module 13: Transformers</a></li>
|
||
</ul>
|
||
</li>
|
||
<li class="toc-h3 nav-item toc-entry"><a class="reference internal nav-link" href="#debugging-strategies">Debugging Strategies</a></li>
|
||
<li class="toc-h3 nav-item toc-entry"><a class="reference internal nav-link" href="#productive-vs-unproductive-struggle">Productive vs Unproductive Struggle</a></li>
|
||
<li class="toc-h3 nav-item toc-entry"><a class="reference internal nav-link" href="#office-hour-patterns">Office Hour Patterns</a></li>
|
||
<li class="toc-h3 nav-item toc-entry"><a class="reference internal nav-link" href="#manual-review-focus-areas">Manual Review Focus Areas</a></li>
|
||
<li class="toc-h3 nav-item toc-entry"><a class="reference internal nav-link" href="#teaching-tips">Teaching Tips</a></li>
|
||
<li class="toc-h3 nav-item toc-entry"><a class="reference internal nav-link" href="#ta-resources">TA Resources</a></li>
|
||
</ul>
|
||
</li>
|
||
<li class="toc-h2 nav-item toc-entry"><a class="reference internal nav-link" href="#additional-resources">Additional Resources</a></li>
|
||
</ul>
|
||
</nav>
|
||
</div>
|
||
</div>
|
||
</div>
|
||
|
||
|
||
|
||
<div id="searchbox"></div>
|
||
<article class="bd-article">
|
||
|
||
<section id="getting-started-with-tinytorch">
|
||
<h1>Getting Started with TinyTorch<a class="headerlink" href="#getting-started-with-tinytorch" title="Link to this heading">#</a></h1>
|
||
<p>Welcome to TinyTorch! This comprehensive guide will get you started whether you’re a student building ML systems, an instructor setting up a course, or a TA supporting learners.</p>
|
||
<div style="background: #f8f9fa; padding: 2rem; border-radius: 0.5rem; margin: 2rem 0; text-align: center;">
|
||
<h2 style="margin: 0 0 1rem 0; color: #495057;">Choose Your Path</h2>
|
||
<p style="margin: 0 0 1.5rem 0; color: #6c757d;">Jump directly to your role-specific guide</p>
|
||
<div style="display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 1rem; max-width: 800px; margin: 0 auto;">
|
||
<a href="#students" style="display: block; background: linear-gradient(135deg, #e3f2fd 0%, #bbdefb 100%); padding: 1.5rem; border-radius: 0.5rem; border-left: 4px solid #1976d2; text-decoration: none; transition: transform 0.2s;">
|
||
<div style="font-size: 2rem; margin-bottom: 0.5rem;">🎓</div>
|
||
<div style="color: #0d47a1; font-weight: 600; font-size: 1.1rem;">Students</div>
|
||
<div style="color: #1565c0; font-size: 0.85rem; margin-top: 0.5rem;">Setup + Build Workflow</div>
|
||
</a>
|
||
<a href="#instructors" style="display: block; background: linear-gradient(135deg, #f3e5f5 0%, #e1bee7 100%); padding: 1.5rem; border-radius: 0.5rem; border-left: 4px solid #7b1fa2; text-decoration: none; transition: transform 0.2s;">
|
||
<div style="font-size: 2rem; margin-bottom: 0.5rem;">👨🏫</div>
|
||
<div style="color: #4a148c; font-weight: 600; font-size: 1.1rem;">Instructors</div>
|
||
<div style="color: #6a1b9a; font-size: 0.85rem; margin-top: 0.5rem;">Course Setup + Grading</div>
|
||
</a>
|
||
<a href="#tas" style="display: block; background: linear-gradient(135deg, #fff3e0 0%, #ffe0b2 100%); padding: 1.5rem; border-radius: 0.5rem; border-left: 4px solid #f57c00; text-decoration: none; transition: transform 0.2s;">
|
||
<div style="font-size: 2rem; margin-bottom: 0.5rem;">👥</div>
|
||
<div style="color: #e65100; font-weight: 600; font-size: 1.1rem;">Teaching Assistants</div>
|
||
<div style="color: #ef6c00; font-size: 0.85rem; margin-top: 0.5rem;">Student Support + Debugging</div>
|
||
</a>
|
||
</div>
|
||
</div>
|
||
<hr class="docutils" />
|
||
<p><a id="students"></a></p>
|
||
<section id="for-students-build-your-ml-framework">
|
||
<h2>🎓 For Students: Build Your ML Framework<a class="headerlink" href="#for-students-build-your-ml-framework" title="Link to this heading">#</a></h2>
|
||
<section id="quick-setup-2-minutes">
|
||
<h3>Quick Setup (2 Minutes)<a class="headerlink" href="#quick-setup-2-minutes" title="Link to this heading">#</a></h3>
|
||
<p>Get your development environment ready to build ML systems from scratch:</p>
|
||
<div class="highlight-bash notranslate"><div class="highlight"><pre><span></span><span class="c1"># Clone repository</span>
|
||
git<span class="w"> </span>clone<span class="w"> </span>https://github.com/mlsysbook/TinyTorch.git
|
||
<span class="nb">cd</span><span class="w"> </span>TinyTorch
|
||
|
||
<span class="c1"># Automated setup (handles everything!)</span>
|
||
./setup-environment.sh
|
||
|
||
<span class="c1"># Activate environment</span>
|
||
<span class="nb">source</span><span class="w"> </span>activate.sh
|
||
|
||
<span class="c1"># Verify setup</span>
|
||
tito<span class="w"> </span>system<span class="w"> </span>health
|
||
</pre></div>
|
||
</div>
|
||
<p><strong>What this does:</strong></p>
|
||
<ul class="simple">
|
||
<li><p>Creates optimized virtual environment</p></li>
|
||
<li><p>Installs all dependencies (NumPy, Jupyter, Rich, PyTorch for validation)</p></li>
|
||
<li><p>Configures TinyTorch in development mode</p></li>
|
||
<li><p>Verifies installation with system diagnostics</p></li>
|
||
</ul>
|
||
</section>
|
||
<section id="join-the-community-optional">
|
||
<h3>Join the Community (Optional)<a class="headerlink" href="#join-the-community-optional" title="Link to this heading">#</a></h3>
|
||
<p>After setup, join the global TinyTorch community and validate your installation:</p>
|
||
<div class="highlight-bash notranslate"><div class="highlight"><pre><span></span><span class="c1"># Join with optional information</span>
|
||
tito<span class="w"> </span>community<span class="w"> </span>join
|
||
|
||
<span class="c1"># Run baseline benchmark to validate setup</span>
|
||
tito<span class="w"> </span>benchmark<span class="w"> </span>baseline
|
||
</pre></div>
|
||
</div>
|
||
<p>All community data is stored locally in <code class="docutils literal notranslate"><span class="pre">.tinytorch/</span></code> directory. See <strong><a class="reference internal" href="community.html"><span class="std std-doc">Community Guide</span></a></strong> for complete features.</p>
|
||
</section>
|
||
<section id="the-tinytorch-build-cycle">
|
||
<h3>The TinyTorch Build Cycle<a class="headerlink" href="#the-tinytorch-build-cycle" title="Link to this heading">#</a></h3>
|
||
<p>TinyTorch follows a simple three-step workflow that you’ll repeat for each module:</p>
|
||
<pre class="mermaid">
|
||
graph LR
|
||
A[1. Edit Module<br/>modules/NN_name.ipynb] --> B[2. Export to Package<br/>tito module complete N]
|
||
B --> C[3. Validate with Milestones<br/>Run milestone scripts]
|
||
C --> A
|
||
|
||
style A fill:#fffbeb
|
||
style B fill:#f0fdf4
|
||
style C fill:#fef3c7
|
||
</pre><section id="step-1-edit-modules">
|
||
<h4>Step 1: Edit Modules<a class="headerlink" href="#step-1-edit-modules" title="Link to this heading">#</a></h4>
|
||
<p>Work on module notebooks interactively:</p>
|
||
<div class="highlight-bash notranslate"><div class="highlight"><pre><span></span><span class="c1"># Example: Working on Module 01 (Tensor)</span>
|
||
<span class="nb">cd</span><span class="w"> </span>modules/01_tensor
|
||
jupyter<span class="w"> </span>lab<span class="w"> </span>01_tensor.ipynb
|
||
</pre></div>
|
||
</div>
|
||
<p>Each module is a Jupyter notebook where you’ll:</p>
|
||
<ul class="simple">
|
||
<li><p>Implement the required functionality from scratch</p></li>
|
||
<li><p>Add docstrings and comments</p></li>
|
||
<li><p>Run and test your code inline</p></li>
|
||
<li><p>See immediate feedback</p></li>
|
||
</ul>
|
||
</section>
|
||
<section id="step-2-export-to-package">
|
||
<h4>Step 2: Export to Package<a class="headerlink" href="#step-2-export-to-package" title="Link to this heading">#</a></h4>
|
||
<p>Once your implementation is complete, export it to the main TinyTorch package:</p>
|
||
<div class="highlight-bash notranslate"><div class="highlight"><pre><span></span>tito<span class="w"> </span>module<span class="w"> </span><span class="nb">complete</span><span class="w"> </span>MODULE_NUMBER
|
||
|
||
<span class="c1"># Example:</span>
|
||
tito<span class="w"> </span>module<span class="w"> </span><span class="nb">complete</span><span class="w"> </span><span class="m">01</span><span class="w"> </span><span class="c1"># Export Module 01 (Tensor)</span>
|
||
</pre></div>
|
||
</div>
|
||
<p>After export, your code becomes importable:</p>
|
||
<div class="highlight-python notranslate"><div class="highlight"><pre><span></span><span class="kn">from</span><span class="w"> </span><span class="nn">tinytorch.core.tensor</span><span class="w"> </span><span class="kn">import</span> <span class="n">Tensor</span> <span class="c1"># YOUR implementation!</span>
|
||
</pre></div>
|
||
</div>
|
||
</section>
|
||
<section id="step-3-validate-with-milestones">
|
||
<h4>Step 3: Validate with Milestones<a class="headerlink" href="#step-3-validate-with-milestones" title="Link to this heading">#</a></h4>
|
||
<p>Run milestone scripts to prove your implementation works:</p>
|
||
<div class="highlight-bash notranslate"><div class="highlight"><pre><span></span><span class="nb">cd</span><span class="w"> </span>milestones/01_1957_perceptron
|
||
python<span class="w"> </span>01_rosenblatt_forward.py<span class="w"> </span><span class="c1"># Uses YOUR Tensor (M01)</span>
|
||
python<span class="w"> </span>02_rosenblatt_trained.py<span class="w"> </span><span class="c1"># Uses YOUR implementation (M01-M07)</span>
|
||
</pre></div>
|
||
</div>
|
||
<p>Each milestone has a README explaining:</p>
|
||
<ul class="simple">
|
||
<li><p>Required modules</p></li>
|
||
<li><p>Historical context</p></li>
|
||
<li><p>Expected results</p></li>
|
||
<li><p>What you’re learning</p></li>
|
||
</ul>
|
||
<p><strong>📖 See <a class="reference internal" href="chapters/milestones.html"><span class="std std-doc">Historical Milestones</span></a></strong> for the complete progression through ML history.</p>
|
||
</section>
|
||
</section>
|
||
<section id="your-first-module-15-minutes">
|
||
<h3>Your First Module (15 Minutes)<a class="headerlink" href="#your-first-module-15-minutes" title="Link to this heading">#</a></h3>
|
||
<p>Start with Module 01 to build tensor operations - the foundation of all neural networks:</p>
|
||
<div class="highlight-bash notranslate"><div class="highlight"><pre><span></span><span class="c1"># Step 1: Edit the module</span>
|
||
<span class="nb">cd</span><span class="w"> </span>modules/01_tensor
|
||
jupyter<span class="w"> </span>lab<span class="w"> </span>01_tensor.ipynb
|
||
|
||
<span class="c1"># Step 2: Export when ready</span>
|
||
tito<span class="w"> </span>module<span class="w"> </span><span class="nb">complete</span><span class="w"> </span><span class="m">01</span>
|
||
|
||
<span class="c1"># Step 3: Validate</span>
|
||
from<span class="w"> </span>tinytorch.core.tensor<span class="w"> </span>import<span class="w"> </span>Tensor
|
||
<span class="nv">x</span><span class="w"> </span><span class="o">=</span><span class="w"> </span>Tensor<span class="o">([</span><span class="m">1</span>,<span class="w"> </span><span class="m">2</span>,<span class="w"> </span><span class="m">3</span><span class="o">])</span><span class="w"> </span><span class="c1"># YOUR implementation!</span>
|
||
</pre></div>
|
||
</div>
|
||
<p><strong>What you’ll implement:</strong></p>
|
||
<ul class="simple">
|
||
<li><p>N-dimensional array creation</p></li>
|
||
<li><p>Mathematical operations (add, multiply, matmul)</p></li>
|
||
<li><p>Shape manipulation (reshape, transpose)</p></li>
|
||
<li><p>Memory layout understanding</p></li>
|
||
</ul>
|
||
</section>
|
||
<section id="module-progression">
|
||
<h3>Module Progression<a class="headerlink" href="#module-progression" title="Link to this heading">#</a></h3>
|
||
<p>TinyTorch has 20 modules organized in progressive tiers:</p>
|
||
<ul class="simple">
|
||
<li><p><strong>Foundation (01-07)</strong>: Core ML infrastructure - tensors, autograd, training</p></li>
|
||
<li><p><strong>Architecture (08-13)</strong>: Neural architectures - data loading, CNNs, transformers</p></li>
|
||
<li><p><strong>Optimization (14-19)</strong>: Production optimization - profiling, quantization, benchmarking</p></li>
|
||
<li><p><strong>Capstone (20)</strong>: Torch Olympics Competition</p></li>
|
||
</ul>
|
||
<p><strong>📖 See <a class="reference internal" href="chapters/00-introduction.html"><span class="std std-doc">Complete Course Structure</span></a></strong> for detailed module descriptions.</p>
|
||
</section>
|
||
<section id="essential-commands-reference">
|
||
<h3>Essential Commands Reference<a class="headerlink" href="#essential-commands-reference" title="Link to this heading">#</a></h3>
|
||
<p>The most important commands you’ll use daily:</p>
|
||
<div class="highlight-bash notranslate"><div class="highlight"><pre><span></span><span class="c1"># Export module to package</span>
|
||
tito<span class="w"> </span>module<span class="w"> </span><span class="nb">complete</span><span class="w"> </span>MODULE_NUMBER
|
||
|
||
<span class="c1"># Check module status (optional)</span>
|
||
tito<span class="w"> </span>checkpoint<span class="w"> </span>status
|
||
|
||
<span class="c1"># System information</span>
|
||
tito<span class="w"> </span>system<span class="w"> </span>info
|
||
|
||
<span class="c1"># Community features</span>
|
||
tito<span class="w"> </span>community<span class="w"> </span>join
|
||
tito<span class="w"> </span>benchmark<span class="w"> </span>baseline
|
||
</pre></div>
|
||
</div>
|
||
<p><strong>📖 See <a class="reference internal" href="tito/overview.html"><span class="std std-doc">TITO CLI Reference</span></a></strong> for complete command documentation.</p>
|
||
</section>
|
||
<section id="notebook-platform-options">
|
||
<h3>Notebook Platform Options<a class="headerlink" href="#notebook-platform-options" title="Link to this heading">#</a></h3>
|
||
<p><strong>For Viewing & Exploration (Online):</strong></p>
|
||
<ul class="simple">
|
||
<li><p>Jupyter/MyBinder: Click “Launch Binder” on any notebook page</p></li>
|
||
<li><p>Google Colab: Click “Launch Colab” for GPU access</p></li>
|
||
<li><p>Marimo: Click “🍃 Open in Marimo” for reactive notebooks</p></li>
|
||
</ul>
|
||
<p><strong>For Full Development (Local - Required):</strong></p>
|
||
<p>To actually build the framework, you need local installation:</p>
|
||
<ul class="simple">
|
||
<li><p>Full <code class="docutils literal notranslate"><span class="pre">tinytorch.*</span></code> package available</p></li>
|
||
<li><p>Run milestone validation scripts</p></li>
|
||
<li><p>Use <code class="docutils literal notranslate"><span class="pre">tito</span></code> CLI commands</p></li>
|
||
<li><p>Execute complete experiments</p></li>
|
||
<li><p>Export modules to package</p></li>
|
||
</ul>
|
||
<p><strong>Note for NBGrader assignments</strong>: Submit <code class="docutils literal notranslate"><span class="pre">.ipynb</span></code> files to preserve grading metadata.</p>
|
||
</section>
|
||
<section id="whats-next">
|
||
<h3>What’s Next?<a class="headerlink" href="#whats-next" title="Link to this heading">#</a></h3>
|
||
<ol class="arabic simple">
|
||
<li><p><strong>Continue Building</strong>: Follow the module progression (01 → 02 → 03…)</p></li>
|
||
<li><p><strong>Run Milestones</strong>: Prove your implementations work with real ML history</p></li>
|
||
<li><p><strong>Build Intuition</strong>: Understand ML systems from first principles</p></li>
|
||
</ol>
|
||
<p>The goal isn’t just to write code - it’s to <strong>understand</strong> how modern ML frameworks work by building one yourself.</p>
|
||
<hr class="docutils" />
|
||
<p><a id="instructors"></a></p>
|
||
</section>
|
||
</section>
|
||
<section id="for-instructors-turn-key-ml-systems-course">
|
||
<h2>👨🏫 For Instructors: Turn-Key ML Systems Course<a class="headerlink" href="#for-instructors-turn-key-ml-systems-course" title="Link to this heading">#</a></h2>
|
||
<section id="course-overview">
|
||
<h3>Course Overview<a class="headerlink" href="#course-overview" title="Link to this heading">#</a></h3>
|
||
<p>TinyTorch provides a complete ML systems engineering course with NBGrader integration, automated grading, and production-ready teaching materials.</p>
|
||
<div style="background: #d4edda; border: 1px solid #28a745; padding: 1.5rem; border-radius: 0.5rem; margin: 1.5rem 0;">
|
||
<h4 style="margin: 0 0 0.5rem 0; color: #155724;">✅ Complete NBGrader Integration Available</h4>
|
||
<p style="margin: 0; color: #155724;">TinyTorch includes automated grading workflows, rubrics, and sample solutions ready for classroom use.</p>
|
||
</div>
|
||
<p><strong>Course Duration:</strong> 14-16 weeks (flexible pacing)
|
||
<strong>Student Outcome:</strong> Complete ML framework supporting vision AND language models
|
||
<strong>Teaching Approach:</strong> Systems-focused learning through building, not just using</p>
|
||
</section>
|
||
<section id="minute-instructor-setup">
|
||
<h3>30-Minute Instructor Setup<a class="headerlink" href="#minute-instructor-setup" title="Link to this heading">#</a></h3>
|
||
<div style="display: grid; grid-template-columns: repeat(auto-fit, minmax(250px, 1fr)); gap: 1.5rem; margin: 2rem 0;">
|
||
<div style="background: white; padding: 1.5rem; border-radius: 0.5rem; border: 1px solid #dee2e6;">
|
||
<h4 style="color: #495057; margin: 0 0 0.5rem 0;">1️⃣ Clone & Setup (10 min)</h4>
|
||
<div style="background: #f8f9fa; padding: 1rem; border-radius: 0.25rem; font-family: monospace; font-size: 0.85rem; margin: 0.5rem 0;">
|
||
git clone TinyTorch<br>
|
||
cd TinyTorch<br>
|
||
python -m venv .venv<br>
|
||
source .venv/bin/activate<br>
|
||
pip install -r requirements.txt<br>
|
||
pip install nbgrader
|
||
</div>
|
||
<p style="font-size: 0.9rem; margin: 0; color: #6c757d;">One-time environment setup</p>
|
||
</div>
|
||
<div style="background: white; padding: 1.5rem; border-radius: 0.5rem; border: 1px solid #dee2e6;">
|
||
<h4 style="color: #495057; margin: 0 0 0.5rem 0;">2️⃣ Initialize Grading (10 min)</h4>
|
||
<div style="background: #f8f9fa; padding: 1rem; border-radius: 0.25rem; font-family: monospace; font-size: 0.85rem; margin: 0.5rem 0;">
|
||
tito grade setup<br>
|
||
tito system health
|
||
</div>
|
||
<p style="font-size: 0.9rem; margin: 0; color: #6c757d;">NBGrader integration & health check</p>
|
||
</div>
|
||
<div style="background: white; padding: 1.5rem; border-radius: 0.5rem; border: 1px solid #dee2e6;">
|
||
<h4 style="color: #495057; margin: 0 0 0.5rem 0;">3️⃣ First Assignment (10 min)</h4>
|
||
<div style="background: #f8f9fa; padding: 1rem; border-radius: 0.25rem; font-family: monospace; font-size: 0.85rem; margin: 0.5rem 0;">
|
||
tito grade generate 01_tensor<br>
|
||
tito grade release 01_tensor
|
||
</div>
|
||
<p style="font-size: 0.9rem; margin: 0; color: #6c757d;">Ready to distribute to students!</p>
|
||
</div>
|
||
</div>
|
||
</section>
|
||
<section id="assignment-workflow">
|
||
<h3>Assignment Workflow<a class="headerlink" href="#assignment-workflow" title="Link to this heading">#</a></h3>
|
||
<p>TinyTorch wraps NBGrader behind simple <code class="docutils literal notranslate"><span class="pre">tito</span> <span class="pre">grade</span></code> commands:</p>
|
||
<p><strong>1. Prepare Assignments</strong></p>
|
||
<div class="highlight-bash notranslate"><div class="highlight"><pre><span></span><span class="c1"># Generate instructor version (with solutions)</span>
|
||
tito<span class="w"> </span>grade<span class="w"> </span>generate<span class="w"> </span>01_tensor
|
||
|
||
<span class="c1"># Create student version (solutions removed)</span>
|
||
tito<span class="w"> </span>grade<span class="w"> </span>release<span class="w"> </span>01_tensor
|
||
</pre></div>
|
||
</div>
|
||
<p><strong>2. Collect Submissions</strong></p>
|
||
<div class="highlight-bash notranslate"><div class="highlight"><pre><span></span><span class="c1"># Collect all students</span>
|
||
tito<span class="w"> </span>grade<span class="w"> </span>collect<span class="w"> </span>01_tensor
|
||
|
||
<span class="c1"># Or specific student</span>
|
||
tito<span class="w"> </span>grade<span class="w"> </span>collect<span class="w"> </span>01_tensor<span class="w"> </span>--student<span class="w"> </span>student_id
|
||
</pre></div>
|
||
</div>
|
||
<p><strong>3. Auto-Grade</strong></p>
|
||
<div class="highlight-bash notranslate"><div class="highlight"><pre><span></span><span class="c1"># Grade all submissions</span>
|
||
tito<span class="w"> </span>grade<span class="w"> </span>autograde<span class="w"> </span>01_tensor
|
||
|
||
<span class="c1"># Grade specific student</span>
|
||
tito<span class="w"> </span>grade<span class="w"> </span>autograde<span class="w"> </span>01_tensor<span class="w"> </span>--student<span class="w"> </span>student_id
|
||
</pre></div>
|
||
</div>
|
||
<p><strong>4. Manual Review</strong></p>
|
||
<div class="highlight-bash notranslate"><div class="highlight"><pre><span></span><span class="c1"># Open grading interface (browser-based)</span>
|
||
tito<span class="w"> </span>grade<span class="w"> </span>manual<span class="w"> </span>01_tensor
|
||
</pre></div>
|
||
</div>
|
||
<p><strong>5. Export Grades</strong></p>
|
||
<div class="highlight-bash notranslate"><div class="highlight"><pre><span></span><span class="c1"># Export all grades to CSV</span>
|
||
tito<span class="w"> </span>grade<span class="w"> </span><span class="nb">export</span>
|
||
|
||
<span class="c1"># Or specific module</span>
|
||
tito<span class="w"> </span>grade<span class="w"> </span><span class="nb">export</span><span class="w"> </span>--module<span class="w"> </span>01_tensor<span class="w"> </span>--output<span class="w"> </span>grades_module01.csv
|
||
</pre></div>
|
||
</div>
|
||
</section>
|
||
<section id="grading-components">
|
||
<h3>Grading Components<a class="headerlink" href="#grading-components" title="Link to this heading">#</a></h3>
|
||
<p><strong>Auto-Graded (70%)</strong></p>
|
||
<ul class="simple">
|
||
<li><p>Code implementation correctness</p></li>
|
||
<li><p>Test passing</p></li>
|
||
<li><p>Function signatures</p></li>
|
||
<li><p>Output validation</p></li>
|
||
</ul>
|
||
<p><strong>Manually Graded (30%)</strong></p>
|
||
<ul class="simple">
|
||
<li><p>ML Systems Thinking questions (3 per module)</p></li>
|
||
<li><p>Each question: 10 points</p></li>
|
||
<li><p>Focus on understanding, not perfection</p></li>
|
||
</ul>
|
||
</section>
|
||
<section id="grading-rubric-for-ml-systems-questions">
|
||
<h3>Grading Rubric for ML Systems Questions<a class="headerlink" href="#grading-rubric-for-ml-systems-questions" title="Link to this heading">#</a></h3>
|
||
<div class="pst-scrollable-table-container"><table class="table">
|
||
<thead>
|
||
<tr class="row-odd"><th class="head"><p>Points</p></th>
|
||
<th class="head"><p>Criteria</p></th>
|
||
</tr>
|
||
</thead>
|
||
<tbody>
|
||
<tr class="row-even"><td><p>9-10</p></td>
|
||
<td><p>Demonstrates deep understanding, references specific code, discusses systems implications</p></td>
|
||
</tr>
|
||
<tr class="row-odd"><td><p>7-8</p></td>
|
||
<td><p>Good understanding, some code references, basic systems thinking</p></td>
|
||
</tr>
|
||
<tr class="row-even"><td><p>5-6</p></td>
|
||
<td><p>Surface understanding, generic response, limited systems perspective</p></td>
|
||
</tr>
|
||
<tr class="row-odd"><td><p>3-4</p></td>
|
||
<td><p>Attempted but misses key concepts</p></td>
|
||
</tr>
|
||
<tr class="row-even"><td><p>0-2</p></td>
|
||
<td><p>No attempt or completely off-topic</p></td>
|
||
</tr>
|
||
</tbody>
|
||
</table>
|
||
</div>
|
||
<p><strong>What to Look For:</strong></p>
|
||
<ul class="simple">
|
||
<li><p>References to actual implemented code</p></li>
|
||
<li><p>Memory/performance analysis</p></li>
|
||
<li><p>Scaling considerations</p></li>
|
||
<li><p>Production system comparisons</p></li>
|
||
<li><p>Understanding of trade-offs</p></li>
|
||
</ul>
|
||
</section>
|
||
<section id="module-teaching-notes">
|
||
<h3>Module Teaching Notes<a class="headerlink" href="#module-teaching-notes" title="Link to this heading">#</a></h3>
|
||
<p><strong>Module 01: Tensor</strong></p>
|
||
<ul class="simple">
|
||
<li><p>Focus: Memory layout, data structures</p></li>
|
||
<li><p>Key Concept: Understanding memory is crucial for ML performance</p></li>
|
||
<li><p>Demo: Show memory profiling, copying behavior</p></li>
|
||
</ul>
|
||
<p><strong>Module 05: Autograd</strong></p>
|
||
<ul class="simple">
|
||
<li><p>Focus: Computational graphs, backpropagation</p></li>
|
||
<li><p>Key Concept: Automatic differentiation enables deep learning</p></li>
|
||
<li><p>Demo: Visualize computational graphs</p></li>
|
||
</ul>
|
||
<p><strong>Module 09: Spatial (CNNs)</strong></p>
|
||
<ul class="simple">
|
||
<li><p>Focus: Algorithmic complexity, memory patterns</p></li>
|
||
<li><p>Key Concept: O(N²) operations become bottlenecks</p></li>
|
||
<li><p>Demo: Profile convolution memory usage</p></li>
|
||
</ul>
|
||
<p><strong>Module 12: Attention</strong></p>
|
||
<ul class="simple">
|
||
<li><p>Focus: Attention mechanisms, scaling</p></li>
|
||
<li><p>Key Concept: Attention is compute-intensive but powerful</p></li>
|
||
<li><p>Demo: Profile attention with different sequence lengths</p></li>
|
||
</ul>
|
||
<p><strong>Module 20: Capstone</strong></p>
|
||
<ul class="simple">
|
||
<li><p>Focus: End-to-end system integration</p></li>
|
||
<li><p>Key Concept: Production requires optimization across all components</p></li>
|
||
<li><p>Project: Torch Olympics Competition</p></li>
|
||
</ul>
|
||
</section>
|
||
<section id="sample-schedule-16-weeks">
|
||
<h3>Sample Schedule (16 Weeks)<a class="headerlink" href="#sample-schedule-16-weeks" title="Link to this heading">#</a></h3>
|
||
<div class="pst-scrollable-table-container"><table class="table">
|
||
<thead>
|
||
<tr class="row-odd"><th class="head"><p>Week</p></th>
|
||
<th class="head"><p>Module</p></th>
|
||
<th class="head"><p>Focus</p></th>
|
||
</tr>
|
||
</thead>
|
||
<tbody>
|
||
<tr class="row-even"><td><p>1</p></td>
|
||
<td><p>01 Tensor</p></td>
|
||
<td><p>Data Structures, Memory</p></td>
|
||
</tr>
|
||
<tr class="row-odd"><td><p>2</p></td>
|
||
<td><p>02 Activations</p></td>
|
||
<td><p>Non-linearity Functions</p></td>
|
||
</tr>
|
||
<tr class="row-even"><td><p>3</p></td>
|
||
<td><p>03 Layers</p></td>
|
||
<td><p>Neural Network Components</p></td>
|
||
</tr>
|
||
<tr class="row-odd"><td><p>4</p></td>
|
||
<td><p>04 Losses</p></td>
|
||
<td><p>Optimization Objectives</p></td>
|
||
</tr>
|
||
<tr class="row-even"><td><p>5</p></td>
|
||
<td><p>05 Autograd</p></td>
|
||
<td><p>Automatic Differentiation</p></td>
|
||
</tr>
|
||
<tr class="row-odd"><td><p>6</p></td>
|
||
<td><p>06 Optimizers</p></td>
|
||
<td><p>Training Algorithms</p></td>
|
||
</tr>
|
||
<tr class="row-even"><td><p>7</p></td>
|
||
<td><p>07 Training</p></td>
|
||
<td><p>Complete Training Loop</p></td>
|
||
</tr>
|
||
<tr class="row-odd"><td><p>8</p></td>
|
||
<td><p>Midterm Project</p></td>
|
||
<td><p>Build and Train Network</p></td>
|
||
</tr>
|
||
<tr class="row-even"><td><p>9</p></td>
|
||
<td><p>08 DataLoader</p></td>
|
||
<td><p>Data Pipeline</p></td>
|
||
</tr>
|
||
<tr class="row-odd"><td><p>10</p></td>
|
||
<td><p>09 Spatial</p></td>
|
||
<td><p>Convolutions, CNNs</p></td>
|
||
</tr>
|
||
<tr class="row-even"><td><p>11</p></td>
|
||
<td><p>10 Tokenization</p></td>
|
||
<td><p>Text Processing</p></td>
|
||
</tr>
|
||
<tr class="row-odd"><td><p>12</p></td>
|
||
<td><p>11 Embeddings</p></td>
|
||
<td><p>Word Representations</p></td>
|
||
</tr>
|
||
<tr class="row-even"><td><p>13</p></td>
|
||
<td><p>12 Attention</p></td>
|
||
<td><p>Attention Mechanisms</p></td>
|
||
</tr>
|
||
<tr class="row-odd"><td><p>14</p></td>
|
||
<td><p>13 Transformers</p></td>
|
||
<td><p>Transformer Architecture</p></td>
|
||
</tr>
|
||
<tr class="row-even"><td><p>15</p></td>
|
||
<td><p>14-19 Optimization</p></td>
|
||
<td><p>Profiling, Quantization</p></td>
|
||
</tr>
|
||
<tr class="row-odd"><td><p>16</p></td>
|
||
<td><p>20 Capstone</p></td>
|
||
<td><p>Torch Olympics</p></td>
|
||
</tr>
|
||
</tbody>
|
||
</table>
|
||
</div>
|
||
</section>
|
||
<section id="assessment-strategy">
|
||
<h3>Assessment Strategy<a class="headerlink" href="#assessment-strategy" title="Link to this heading">#</a></h3>
|
||
<p><strong>Continuous Assessment (70%)</strong></p>
|
||
<ul class="simple">
|
||
<li><p>Module completion: 4% each × 16 = 64%</p></li>
|
||
<li><p>Checkpoint achievements: 6%</p></li>
|
||
</ul>
|
||
<p><strong>Projects (30%)</strong></p>
|
||
<ul class="simple">
|
||
<li><p>Midterm: Build and train CNN (15%)</p></li>
|
||
<li><p>Final: Torch Olympics Competition (15%)</p></li>
|
||
</ul>
|
||
</section>
|
||
<section id="instructor-resources">
|
||
<h3>Instructor Resources<a class="headerlink" href="#instructor-resources" title="Link to this heading">#</a></h3>
|
||
<ul class="simple">
|
||
<li><p><strong>Complete grading rubrics</strong> with sample solutions</p></li>
|
||
<li><p><strong>Module-specific teaching notes</strong> in each <a class="reference external" href="http://ABOUT.md">ABOUT.md</a> file</p></li>
|
||
<li><p><strong>Progress tracking tools</strong> (<code class="docutils literal notranslate"><span class="pre">tito</span> <span class="pre">checkpoint</span> <span class="pre">status</span> <span class="pre">--student</span> <span class="pre">ID</span></code>)</p></li>
|
||
<li><p><strong>System health monitoring</strong> (<code class="docutils literal notranslate"><span class="pre">tito</span> <span class="pre">module</span> <span class="pre">status</span> <span class="pre">--comprehensive</span></code>)</p></li>
|
||
<li><p><strong>Community support</strong> via GitHub Issues</p></li>
|
||
</ul>
|
||
<p><strong>📖 See <a class="reference internal" href="chapters/00-introduction.html"><span class="std std-doc">Complete Course Structure</span></a></strong> for full curriculum overview.</p>
|
||
<hr class="docutils" />
|
||
<p><a id="tas"></a></p>
|
||
</section>
|
||
</section>
|
||
<section id="for-teaching-assistants-student-support-guide">
|
||
<h2>👥 For Teaching Assistants: Student Support Guide<a class="headerlink" href="#for-teaching-assistants-student-support-guide" title="Link to this heading">#</a></h2>
|
||
<section id="ta-preparation">
|
||
<h3>TA Preparation<a class="headerlink" href="#ta-preparation" title="Link to this heading">#</a></h3>
|
||
<p>Develop deep familiarity with modules where students commonly struggle:</p>
|
||
<p><strong>Critical Modules:</strong></p>
|
||
<ol class="arabic simple">
|
||
<li><p><strong>Module 05: Autograd</strong> - Most conceptually challenging</p></li>
|
||
<li><p><strong>Module 09: CNNs (Spatial)</strong> - Complex nested loops and memory patterns</p></li>
|
||
<li><p><strong>Module 13: Transformers</strong> - Attention mechanisms and scaling</p></li>
|
||
</ol>
|
||
<p><strong>Preparation Process:</strong></p>
|
||
<ol class="arabic simple">
|
||
<li><p>Complete all three critical modules yourself</p></li>
|
||
<li><p>Introduce bugs intentionally to understand error patterns</p></li>
|
||
<li><p>Practice debugging common scenarios</p></li>
|
||
<li><p>Review past student submissions</p></li>
|
||
</ol>
|
||
</section>
|
||
<section id="common-student-errors">
|
||
<h3>Common Student Errors<a class="headerlink" href="#common-student-errors" title="Link to this heading">#</a></h3>
|
||
<section id="module-05-autograd">
|
||
<h4>Module 05: Autograd<a class="headerlink" href="#module-05-autograd" title="Link to this heading">#</a></h4>
|
||
<p><strong>Error 1: Gradient Shape Mismatches</strong></p>
|
||
<ul class="simple">
|
||
<li><p>Symptom: <code class="docutils literal notranslate"><span class="pre">ValueError:</span> <span class="pre">shapes</span> <span class="pre">don't</span> <span class="pre">match</span> <span class="pre">for</span> <span class="pre">gradient</span></code></p></li>
|
||
<li><p>Common Cause: Incorrect gradient accumulation or shape handling</p></li>
|
||
<li><p>Debugging: Check gradient shapes match parameter shapes, verify accumulation logic</p></li>
|
||
</ul>
|
||
<p><strong>Error 2: Disconnected Computational Graph</strong></p>
|
||
<ul class="simple">
|
||
<li><p>Symptom: Gradients are None or zero</p></li>
|
||
<li><p>Common Cause: Operations not tracked in computational graph</p></li>
|
||
<li><p>Debugging: Verify <code class="docutils literal notranslate"><span class="pre">requires_grad=True</span></code>, check operations create new Tensor objects</p></li>
|
||
</ul>
|
||
<p><strong>Error 3: Broadcasting Failures</strong></p>
|
||
<ul class="simple">
|
||
<li><p>Symptom: Shape errors during backward pass</p></li>
|
||
<li><p>Common Cause: Incorrect handling of broadcasted operations</p></li>
|
||
<li><p>Debugging: Understand NumPy broadcasting, check gradient accumulation for broadcasted dims</p></li>
|
||
</ul>
|
||
</section>
|
||
<section id="module-09-cnns-spatial">
|
||
<h4>Module 09: CNNs (Spatial)<a class="headerlink" href="#module-09-cnns-spatial" title="Link to this heading">#</a></h4>
|
||
<p><strong>Error 1: Index Out of Bounds</strong></p>
|
||
<ul class="simple">
|
||
<li><p>Symptom: <code class="docutils literal notranslate"><span class="pre">IndexError</span></code> in convolution loops</p></li>
|
||
<li><p>Common Cause: Incorrect padding or stride calculations</p></li>
|
||
<li><p>Debugging: Verify output shape calculations, check padding logic</p></li>
|
||
</ul>
|
||
<p><strong>Error 2: Memory Issues</strong></p>
|
||
<ul class="simple">
|
||
<li><p>Symptom: Out of memory errors</p></li>
|
||
<li><p>Common Cause: Creating unnecessary intermediate arrays</p></li>
|
||
<li><p>Debugging: Profile memory usage, look for unnecessary copies, optimize loop structure</p></li>
|
||
</ul>
|
||
</section>
|
||
<section id="module-13-transformers">
|
||
<h4>Module 13: Transformers<a class="headerlink" href="#module-13-transformers" title="Link to this heading">#</a></h4>
|
||
<p><strong>Error 1: Attention Scaling Issues</strong></p>
|
||
<ul class="simple">
|
||
<li><p>Symptom: Attention weights don’t sum to 1</p></li>
|
||
<li><p>Common Cause: Missing softmax or incorrect scaling</p></li>
|
||
<li><p>Debugging: Verify softmax is applied, check scaling factor (1/sqrt(d_k))</p></li>
|
||
</ul>
|
||
<p><strong>Error 2: Positional Encoding Errors</strong></p>
|
||
<ul class="simple">
|
||
<li><p>Symptom: Model doesn’t learn positional information</p></li>
|
||
<li><p>Common Cause: Incorrect positional encoding implementation</p></li>
|
||
<li><p>Debugging: Verify sinusoidal patterns, check encoding is added correctly</p></li>
|
||
</ul>
|
||
</section>
|
||
</section>
|
||
<section id="debugging-strategies">
|
||
<h3>Debugging Strategies<a class="headerlink" href="#debugging-strategies" title="Link to this heading">#</a></h3>
|
||
<p>When students ask for help, guide them with questions rather than giving answers:</p>
|
||
<ol class="arabic simple">
|
||
<li><p><strong>What error message are you seeing?</strong> - Read full traceback</p></li>
|
||
<li><p><strong>What did you expect to happen?</strong> - Clarify their mental model</p></li>
|
||
<li><p><strong>What actually happened?</strong> - Compare expected vs actual</p></li>
|
||
<li><p><strong>What have you tried?</strong> - Avoid repeating failed approaches</p></li>
|
||
<li><p><strong>Can you test with a simpler case?</strong> - Reduce complexity</p></li>
|
||
</ol>
|
||
</section>
|
||
<section id="productive-vs-unproductive-struggle">
|
||
<h3>Productive vs Unproductive Struggle<a class="headerlink" href="#productive-vs-unproductive-struggle" title="Link to this heading">#</a></h3>
|
||
<p><strong>Productive Struggle (encourage):</strong></p>
|
||
<ul class="simple">
|
||
<li><p>Trying different approaches</p></li>
|
||
<li><p>Making incremental progress</p></li>
|
||
<li><p>Understanding error messages</p></li>
|
||
<li><p>Passing additional tests over time</p></li>
|
||
</ul>
|
||
<p><strong>Unproductive Frustration (intervene):</strong></p>
|
||
<ul class="simple">
|
||
<li><p>Repeated identical errors</p></li>
|
||
<li><p>Random code changes</p></li>
|
||
<li><p>Unable to articulate the problem</p></li>
|
||
<li><p>No progress after 30+ minutes</p></li>
|
||
</ul>
|
||
</section>
|
||
<section id="office-hour-patterns">
|
||
<h3>Office Hour Patterns<a class="headerlink" href="#office-hour-patterns" title="Link to this heading">#</a></h3>
|
||
<p><strong>Expected Demand Spikes:</strong></p>
|
||
<ul class="simple">
|
||
<li><p><strong>Module 05 (Autograd)</strong>: Highest demand</p>
|
||
<ul>
|
||
<li><p>Schedule additional TA capacity</p></li>
|
||
<li><p>Pre-record debugging walkthroughs</p></li>
|
||
<li><p>Create FAQ document</p></li>
|
||
</ul>
|
||
</li>
|
||
<li><p><strong>Module 09 (CNNs)</strong>: High demand</p>
|
||
<ul>
|
||
<li><p>Focus on memory profiling</p></li>
|
||
<li><p>Loop optimization strategies</p></li>
|
||
<li><p>Padding/stride calculations</p></li>
|
||
</ul>
|
||
</li>
|
||
<li><p><strong>Module 13 (Transformers)</strong>: Moderate-high demand</p>
|
||
<ul>
|
||
<li><p>Attention mechanism debugging</p></li>
|
||
<li><p>Positional encoding issues</p></li>
|
||
<li><p>Scaling problems</p></li>
|
||
</ul>
|
||
</li>
|
||
</ul>
|
||
</section>
|
||
<section id="manual-review-focus-areas">
|
||
<h3>Manual Review Focus Areas<a class="headerlink" href="#manual-review-focus-areas" title="Link to this heading">#</a></h3>
|
||
<p>While NBGrader automates 70-80% of assessment, focus manual review on:</p>
|
||
<ol class="arabic simple">
|
||
<li><p><strong>Code Clarity and Design Choices</strong></p>
|
||
<ul class="simple">
|
||
<li><p>Is code readable?</p></li>
|
||
<li><p>Are design decisions justified?</p></li>
|
||
<li><p>Is the implementation clean?</p></li>
|
||
</ul>
|
||
</li>
|
||
<li><p><strong>Edge Case Handling</strong></p>
|
||
<ul class="simple">
|
||
<li><p>Does code handle edge cases?</p></li>
|
||
<li><p>Are there appropriate checks?</p></li>
|
||
<li><p>Is error handling present?</p></li>
|
||
</ul>
|
||
</li>
|
||
<li><p><strong>Systems Thinking Analysis</strong></p>
|
||
<ul class="simple">
|
||
<li><p>Do students understand complexity?</p></li>
|
||
<li><p>Can they analyze their code?</p></li>
|
||
<li><p>Do they recognize bottlenecks?</p></li>
|
||
</ul>
|
||
</li>
|
||
</ol>
|
||
</section>
|
||
<section id="teaching-tips">
|
||
<h3>Teaching Tips<a class="headerlink" href="#teaching-tips" title="Link to this heading">#</a></h3>
|
||
<ol class="arabic simple">
|
||
<li><p><strong>Encourage Exploration</strong> - Let students try different approaches</p></li>
|
||
<li><p><strong>Connect to Production</strong> - Reference PyTorch equivalents and real-world scenarios</p></li>
|
||
<li><p><strong>Make Systems Visible</strong> - Profile memory usage, analyze complexity together</p></li>
|
||
<li><p><strong>Build Confidence</strong> - Acknowledge progress and validate understanding</p></li>
|
||
</ol>
|
||
</section>
|
||
<section id="ta-resources">
|
||
<h3>TA Resources<a class="headerlink" href="#ta-resources" title="Link to this heading">#</a></h3>
|
||
<ul class="simple">
|
||
<li><p>Module-specific <a class="reference external" href="http://ABOUT.md">ABOUT.md</a> files with common pitfalls</p></li>
|
||
<li><p>Grading rubrics with sample excellent/good/acceptable solutions</p></li>
|
||
<li><p>System diagnostics tools (<code class="docutils literal notranslate"><span class="pre">tito</span> <span class="pre">system</span> <span class="pre">health</span></code>)</p></li>
|
||
<li><p>Progress tracking (<code class="docutils literal notranslate"><span class="pre">tito</span> <span class="pre">checkpoint</span> <span class="pre">status</span> <span class="pre">--student</span> <span class="pre">ID</span></code>)</p></li>
|
||
</ul>
|
||
</section>
|
||
</section>
|
||
<hr class="docutils" />
|
||
<section id="additional-resources">
|
||
<h2>Additional Resources<a class="headerlink" href="#additional-resources" title="Link to this heading">#</a></h2>
|
||
<div style="display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 1.5rem; margin: 2rem 0;">
|
||
<div style="background: #f0f9ff; padding: 1.5rem; border-radius: 0.5rem; border-left: 4px solid #3b82f6;">
|
||
<h4 style="margin: 0 0 0.5rem 0; color: #1e40af;">📚 Course Documentation</h4>
|
||
<ul style="margin: 0.5rem 0; padding-left: 1.25rem; font-size: 0.9rem;">
|
||
<li><a href="chapters/00-introduction.html">Complete Course Structure</a></li>
|
||
<li><a href="chapters/milestones.html">Historical Milestones</a></li>
|
||
<li><a href="prerequisites.html">Prerequisites & Resources</a></li>
|
||
<li><a href="faq.html">Frequently Asked Questions</a></li>
|
||
</ul>
|
||
</div>
|
||
<div style="background: #f0fdf4; padding: 1.5rem; border-radius: 0.5rem; border-left: 4px solid #22c55e;">
|
||
<h4 style="margin: 0 0 0.5rem 0; color: #166534;">🛠️ CLI & Tools</h4>
|
||
<ul style="margin: 0.5rem 0; padding-left: 1.25rem; font-size: 0.9rem;">
|
||
<li><a href="tito/overview.html">TITO CLI Overview</a></li>
|
||
<li><a href="tito/modules.html">Module Workflow</a></li>
|
||
<li><a href="tito/milestones.html">Milestone System</a></li>
|
||
<li><a href="tito/troubleshooting.html">Troubleshooting</a></li>
|
||
</ul>
|
||
</div>
|
||
<div style="background: #fef3c7; padding: 1.5rem; border-radius: 0.5rem; border-left: 4px solid #eab308;">
|
||
<h4 style="margin: 0 0 0.5rem 0; color: #a16207;">🤝 Community</h4>
|
||
<ul style="margin: 0.5rem 0; padding-left: 1.25rem; font-size: 0.9rem;">
|
||
<li><a href="community.html">Community Ecosystem</a></li>
|
||
<li><a href="resources.html">Learning Resources</a></li>
|
||
<li><a href="credits.html">Credits & Acknowledgments</a></li>
|
||
<li><a href="https://github.com/mlsysbook/TinyTorch/discussions">GitHub Discussions</a></li>
|
||
</ul>
|
||
</div>
|
||
</div>
|
||
<hr class="docutils" />
|
||
<p><strong>Ready to start building?</strong> Choose your path above and dive into the most comprehensive ML systems course available!</p>
|
||
</section>
|
||
</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 d-print-none">
|
||
|
||
<div class="prev-next-area">
|
||
<a class="left-prev"
|
||
href="intro.html"
|
||
title="previous page">
|
||
<i class="fa-solid fa-angle-left"></i>
|
||
<div class="prev-next-info">
|
||
<p class="prev-next-subtitle">previous</p>
|
||
<p class="prev-next-title">Getting Started</p>
|
||
</div>
|
||
</a>
|
||
<a class="right-next"
|
||
href="tiers/foundation.html"
|
||
title="next page">
|
||
<div class="prev-next-info">
|
||
<p class="prev-next-subtitle">next</p>
|
||
<p class="prev-next-title">🏗 Foundation Tier (Modules 01-07)</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="#for-students-build-your-ml-framework">🎓 For Students: Build Your ML Framework</a><ul class="nav section-nav flex-column">
|
||
<li class="toc-h3 nav-item toc-entry"><a class="reference internal nav-link" href="#quick-setup-2-minutes">Quick Setup (2 Minutes)</a></li>
|
||
<li class="toc-h3 nav-item toc-entry"><a class="reference internal nav-link" href="#join-the-community-optional">Join the Community (Optional)</a></li>
|
||
<li class="toc-h3 nav-item toc-entry"><a class="reference internal nav-link" href="#the-tinytorch-build-cycle">The TinyTorch Build Cycle</a><ul class="nav section-nav flex-column">
|
||
<li class="toc-h4 nav-item toc-entry"><a class="reference internal nav-link" href="#step-1-edit-modules">Step 1: Edit Modules</a></li>
|
||
<li class="toc-h4 nav-item toc-entry"><a class="reference internal nav-link" href="#step-2-export-to-package">Step 2: Export to Package</a></li>
|
||
<li class="toc-h4 nav-item toc-entry"><a class="reference internal nav-link" href="#step-3-validate-with-milestones">Step 3: Validate with Milestones</a></li>
|
||
</ul>
|
||
</li>
|
||
<li class="toc-h3 nav-item toc-entry"><a class="reference internal nav-link" href="#your-first-module-15-minutes">Your First Module (15 Minutes)</a></li>
|
||
<li class="toc-h3 nav-item toc-entry"><a class="reference internal nav-link" href="#module-progression">Module Progression</a></li>
|
||
<li class="toc-h3 nav-item toc-entry"><a class="reference internal nav-link" href="#essential-commands-reference">Essential Commands Reference</a></li>
|
||
<li class="toc-h3 nav-item toc-entry"><a class="reference internal nav-link" href="#notebook-platform-options">Notebook Platform Options</a></li>
|
||
<li class="toc-h3 nav-item toc-entry"><a class="reference internal nav-link" href="#whats-next">What’s Next?</a></li>
|
||
</ul>
|
||
</li>
|
||
<li class="toc-h2 nav-item toc-entry"><a class="reference internal nav-link" href="#for-instructors-turn-key-ml-systems-course">👨🏫 For Instructors: Turn-Key ML Systems Course</a><ul class="nav section-nav flex-column">
|
||
<li class="toc-h3 nav-item toc-entry"><a class="reference internal nav-link" href="#course-overview">Course Overview</a></li>
|
||
<li class="toc-h3 nav-item toc-entry"><a class="reference internal nav-link" href="#minute-instructor-setup">30-Minute Instructor Setup</a></li>
|
||
<li class="toc-h3 nav-item toc-entry"><a class="reference internal nav-link" href="#assignment-workflow">Assignment Workflow</a></li>
|
||
<li class="toc-h3 nav-item toc-entry"><a class="reference internal nav-link" href="#grading-components">Grading Components</a></li>
|
||
<li class="toc-h3 nav-item toc-entry"><a class="reference internal nav-link" href="#grading-rubric-for-ml-systems-questions">Grading Rubric for ML Systems Questions</a></li>
|
||
<li class="toc-h3 nav-item toc-entry"><a class="reference internal nav-link" href="#module-teaching-notes">Module Teaching Notes</a></li>
|
||
<li class="toc-h3 nav-item toc-entry"><a class="reference internal nav-link" href="#sample-schedule-16-weeks">Sample Schedule (16 Weeks)</a></li>
|
||
<li class="toc-h3 nav-item toc-entry"><a class="reference internal nav-link" href="#assessment-strategy">Assessment Strategy</a></li>
|
||
<li class="toc-h3 nav-item toc-entry"><a class="reference internal nav-link" href="#instructor-resources">Instructor Resources</a></li>
|
||
</ul>
|
||
</li>
|
||
<li class="toc-h2 nav-item toc-entry"><a class="reference internal nav-link" href="#for-teaching-assistants-student-support-guide">👥 For Teaching Assistants: Student Support Guide</a><ul class="nav section-nav flex-column">
|
||
<li class="toc-h3 nav-item toc-entry"><a class="reference internal nav-link" href="#ta-preparation">TA Preparation</a></li>
|
||
<li class="toc-h3 nav-item toc-entry"><a class="reference internal nav-link" href="#common-student-errors">Common Student Errors</a><ul class="nav section-nav flex-column">
|
||
<li class="toc-h4 nav-item toc-entry"><a class="reference internal nav-link" href="#module-05-autograd">Module 05: Autograd</a></li>
|
||
<li class="toc-h4 nav-item toc-entry"><a class="reference internal nav-link" href="#module-09-cnns-spatial">Module 09: CNNs (Spatial)</a></li>
|
||
<li class="toc-h4 nav-item toc-entry"><a class="reference internal nav-link" href="#module-13-transformers">Module 13: Transformers</a></li>
|
||
</ul>
|
||
</li>
|
||
<li class="toc-h3 nav-item toc-entry"><a class="reference internal nav-link" href="#debugging-strategies">Debugging Strategies</a></li>
|
||
<li class="toc-h3 nav-item toc-entry"><a class="reference internal nav-link" href="#productive-vs-unproductive-struggle">Productive vs Unproductive Struggle</a></li>
|
||
<li class="toc-h3 nav-item toc-entry"><a class="reference internal nav-link" href="#office-hour-patterns">Office Hour Patterns</a></li>
|
||
<li class="toc-h3 nav-item toc-entry"><a class="reference internal nav-link" href="#manual-review-focus-areas">Manual Review Focus Areas</a></li>
|
||
<li class="toc-h3 nav-item toc-entry"><a class="reference internal nav-link" href="#teaching-tips">Teaching Tips</a></li>
|
||
<li class="toc-h3 nav-item toc-entry"><a class="reference internal nav-link" href="#ta-resources">TA Resources</a></li>
|
||
</ul>
|
||
</li>
|
||
<li class="toc-h2 nav-item toc-entry"><a class="reference internal nav-link" href="#additional-resources">Additional Resources</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 2025.
|
||
<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=dfe6caa3a7d634c4db9b"></script>
|
||
<script src="_static/scripts/pydata-sphinx-theme.js?digest=dfe6caa3a7d634c4db9b"></script>
|
||
|
||
<footer class="bd-footer">
|
||
</footer>
|
||
</body>
|
||
</html> |