mirror of
https://github.com/MLSysBook/TinyTorch.git
synced 2026-05-26 09:36:48 -05:00
1339 lines
59 KiB
HTML
1339 lines
59 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>Module Workflow — 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=afcf7c3c" />
|
||
|
||
<!-- 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 = 'tito/modules';</script>
|
||
<script src="../_static/ml-timeline.js?v=76e9b3e3"></script>
|
||
<script src="../_static/wip-banner.js?v=5357532b"></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>
|
||
<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="Milestone System" href="milestones.html" />
|
||
<link rel="prev" title="TITO Command Reference" href="overview.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="nav bd-sidenav">
|
||
<li class="toctree-l1"><a class="reference internal" href="../getting-started.html">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>
|
||
</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>
|
||
</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>
|
||
</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>
|
||
</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="current nav bd-sidenav">
|
||
<li class="toctree-l1"><a class="reference internal" href="overview.html">Command Overview</a></li>
|
||
<li class="toctree-l1 current active"><a class="current reference internal" href="#">Module Workflow</a></li>
|
||
<li class="toctree-l1"><a class="reference internal" href="milestones.html">Milestone System</a></li>
|
||
<li class="toctree-l1"><a class="reference internal" href="data.html">Progress & Data</a></li>
|
||
<li class="toctree-l1"><a class="reference internal" href="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/tito/modules.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>Module Workflow</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-workflow">The Core Workflow</a></li>
|
||
<li class="toc-h2 nav-item toc-entry"><a class="reference internal nav-link" href="#essential-commands">Essential Commands</a></li>
|
||
<li class="toc-h2 nav-item toc-entry"><a class="reference internal nav-link" href="#typical-development-session">Typical Development Session</a></li>
|
||
<li class="toc-h2 nav-item toc-entry"><a class="reference internal nav-link" href="#system-commands">System Commands</a><ul class="nav section-nav flex-column">
|
||
<li class="toc-h3 nav-item toc-entry"><a class="reference internal nav-link" href="#environment-health">Environment Health</a></li>
|
||
</ul>
|
||
</li>
|
||
<li class="toc-h2 nav-item toc-entry"><a class="reference internal nav-link" href="#module-lifecycle-commands">Module Lifecycle Commands</a><ul class="nav section-nav flex-column">
|
||
<li class="toc-h3 nav-item toc-entry"><a class="reference internal nav-link" href="#start-a-module-first-time">Start a Module (First Time)</a></li>
|
||
<li class="toc-h3 nav-item toc-entry"><a class="reference internal nav-link" href="#resume-work-continue-later">Resume Work (Continue Later)</a></li>
|
||
<li class="toc-h3 nav-item toc-entry"><a class="reference internal nav-link" href="#complete-export-essential">Complete & Export (Essential)</a></li>
|
||
<li class="toc-h3 nav-item toc-entry"><a class="reference internal nav-link" href="#view-progress">View Progress</a></li>
|
||
<li class="toc-h3 nav-item toc-entry"><a class="reference internal nav-link" href="#reset-module-advanced">Reset Module (Advanced)</a></li>
|
||
</ul>
|
||
</li>
|
||
<li class="toc-h2 nav-item toc-entry"><a class="reference internal nav-link" href="#understanding-the-export-process">Understanding the Export Process</a></li>
|
||
<li class="toc-h2 nav-item toc-entry"><a class="reference internal nav-link" href="#module-structure">Module Structure</a><ul class="nav section-nav flex-column">
|
||
<li class="toc-h3 nav-item toc-entry"><a class="reference internal nav-link" href="#development-structure">Development Structure</a></li>
|
||
<li class="toc-h3 nav-item toc-entry"><a class="reference internal nav-link" href="#where-code-exports">Where Code Exports</a></li>
|
||
</ul>
|
||
</li>
|
||
<li class="toc-h2 nav-item toc-entry"><a class="reference internal nav-link" href="#troubleshooting">Troubleshooting</a><ul class="nav section-nav flex-column">
|
||
<li class="toc-h3 nav-item toc-entry"><a class="reference internal nav-link" href="#environment-not-ready">Environment Not Ready</a></li>
|
||
<li class="toc-h3 nav-item toc-entry"><a class="reference internal nav-link" href="#export-fails">Export Fails</a></li>
|
||
<li class="toc-h3 nav-item toc-entry"><a class="reference internal nav-link" href="#import-errors">Import Errors</a></li>
|
||
</ul>
|
||
</li>
|
||
<li class="toc-h2 nav-item toc-entry"><a class="reference internal nav-link" href="#next-steps">Next Steps</a></li>
|
||
</ul>
|
||
</nav>
|
||
</div>
|
||
</div>
|
||
</div>
|
||
|
||
|
||
|
||
<div id="searchbox"></div>
|
||
<article class="bd-article">
|
||
|
||
<section id="module-workflow">
|
||
<h1>Module Workflow<a class="headerlink" href="#module-workflow" title="Link to this heading">#</a></h1>
|
||
<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;">Build ML Systems from Scratch</h2>
|
||
<p style="margin: 0; font-size: 1.1rem; color: #6c757d;">The core workflow for implementing and exporting TinyTorch modules</p>
|
||
</div>
|
||
<p><strong>Purpose</strong>: Master the module development workflow - the heart of TinyTorch. Learn how to implement modules, export them to your package, and validate with tests.</p>
|
||
<section id="the-core-workflow">
|
||
<h2>The Core Workflow<a class="headerlink" href="#the-core-workflow" title="Link to this heading">#</a></h2>
|
||
<p>TinyTorch follows a simple build-export-validate cycle:</p>
|
||
<pre class="mermaid">
|
||
graph LR
|
||
A[Start/Resume Module] --> B[Edit in Jupyter]
|
||
B --> C[Complete & Export]
|
||
C --> D[Test Import]
|
||
D --> E[Next Module]
|
||
|
||
style A fill:#e3f2fd
|
||
style B fill:#fffbeb
|
||
style C fill:#f0fdf4
|
||
style D fill:#fef3c7
|
||
style E fill:#f3e5f5
|
||
</pre><p><strong>The essential command</strong>: <code class="docutils literal notranslate"><span class="pre">tito</span> <span class="pre">module</span> <span class="pre">complete</span> <span class="pre">XX</span></code> - exports your code to the TinyTorch package</p>
|
||
<p>See <span class="xref myst">Student Workflow</span> for the complete development cycle and best practices.</p>
|
||
</section>
|
||
<hr class="docutils" />
|
||
<section id="essential-commands">
|
||
<h2>Essential Commands<a class="headerlink" href="#essential-commands" title="Link to this heading">#</a></h2>
|
||
<div style="display: grid; grid-template-columns: 1fr; gap: 1rem; margin: 2rem 0;">
|
||
<div style="background: #e3f2fd; padding: 1.5rem; border-radius: 0.5rem; border-left: 4px solid #2196f3;">
|
||
<h4 style="margin: 0 0 0.5rem 0; color: #1976d2;">Check Environment</h4>
|
||
<code style="background: #263238; color: #ffffff; padding: 0.5rem; border-radius: 0.25rem; display: block; margin: 0.5rem 0;">tito system health</code>
|
||
<p style="margin: 0.5rem 0 0 0; font-size: 0.9rem; color: #64748b;">Verify your setup is ready before starting</p>
|
||
</div>
|
||
<div style="background: #fffbeb; padding: 1.5rem; border-radius: 0.5rem; border-left: 4px solid #f59e0b;">
|
||
<h4 style="margin: 0 0 0.5rem 0; color: #d97706;">Start a Module (First Time)</h4>
|
||
<code style="background: #263238; color: #ffffff; padding: 0.5rem; border-radius: 0.25rem; display: block; margin: 0.5rem 0;">tito module start 01</code>
|
||
<p style="margin: 0.5rem 0 0 0; font-size: 0.9rem; color: #64748b;">Opens Jupyter Lab for Module 01 (Tensor)</p>
|
||
</div>
|
||
<div style="background: #f3e5f5; padding: 1.5rem; border-radius: 0.5rem; border-left: 4px solid #9c27b0;">
|
||
<h4 style="margin: 0 0 0.5rem 0; color: #7b1fa2;">Resume Work (Continue Later)</h4>
|
||
<code style="background: #263238; color: #ffffff; padding: 0.5rem; border-radius: 0.25rem; display: block; margin: 0.5rem 0;">tito module resume 01</code>
|
||
<p style="margin: 0.5rem 0 0 0; font-size: 0.9rem; color: #64748b;">Continue working on Module 01 where you left off</p>
|
||
</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: #15803d;">Export & Complete (Essential)</h4>
|
||
<code style="background: #263238; color: #ffffff; padding: 0.5rem; border-radius: 0.25rem; display: block; margin: 0.5rem 0;">tito module complete 01</code>
|
||
<p style="margin: 0.5rem 0 0 0; font-size: 0.9rem; color: #64748b;">Export Module 01 to TinyTorch package - THE key command</p>
|
||
</div>
|
||
<div style="background: #fef3c7; padding: 1.5rem; border-radius: 0.5rem; border-left: 4px solid #f59e0b;">
|
||
<h4 style="margin: 0 0 0.5rem 0; color: #d97706;">Check Progress</h4>
|
||
<code style="background: #263238; color: #ffffff; padding: 0.5rem; border-radius: 0.25rem; display: block; margin: 0.5rem 0;">tito module status</code>
|
||
<p style="margin: 0.5rem 0 0 0; font-size: 0.9rem; color: #64748b;">See which modules you've completed</p>
|
||
</div>
|
||
</div>
|
||
</section>
|
||
<hr class="docutils" />
|
||
<section id="typical-development-session">
|
||
<h2>Typical Development Session<a class="headerlink" href="#typical-development-session" title="Link to this heading">#</a></h2>
|
||
<p>Here’s what a complete session looks like:</p>
|
||
<div style="background: #f8f9fa; padding: 1.5rem; border: 1px solid #dee2e6; border-radius: 0.5rem; margin: 1.5rem 0;">
|
||
<p><strong>1. Start Session</strong></p>
|
||
<div class="highlight-bash notranslate"><div class="highlight"><pre><span></span><span class="nb">cd</span><span class="w"> </span>TinyTorch
|
||
<span class="nb">source</span><span class="w"> </span>activate.sh
|
||
tito<span class="w"> </span>system<span class="w"> </span>health<span class="w"> </span><span class="c1"># Verify environment</span>
|
||
</pre></div>
|
||
</div>
|
||
<p><strong>2. Start or Resume Module</strong></p>
|
||
<div class="highlight-bash notranslate"><div class="highlight"><pre><span></span><span class="c1"># First time working on Module 03</span>
|
||
tito<span class="w"> </span>module<span class="w"> </span>start<span class="w"> </span><span class="m">03</span>
|
||
|
||
<span class="c1"># OR: Continue from where you left off</span>
|
||
tito<span class="w"> </span>module<span class="w"> </span>resume<span class="w"> </span><span class="m">03</span>
|
||
</pre></div>
|
||
</div>
|
||
<p>This opens Jupyter Lab with the module notebook.</p>
|
||
<p><strong>3. Edit in Jupyter Lab</strong></p>
|
||
<div class="highlight-python notranslate"><div class="highlight"><pre><span></span><span class="c1"># In the generated notebook</span>
|
||
<span class="k">class</span><span class="w"> </span><span class="nc">Linear</span><span class="p">:</span>
|
||
<span class="k">def</span><span class="w"> </span><span class="fm">__init__</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">in_features</span><span class="p">,</span> <span class="n">out_features</span><span class="p">):</span>
|
||
<span class="c1"># YOUR implementation here</span>
|
||
<span class="o">...</span>
|
||
</pre></div>
|
||
</div>
|
||
<p>Work interactively:</p>
|
||
<ul class="simple">
|
||
<li><p>Implement the required functionality</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>
|
||
<p><strong>4. Export to Package</strong></p>
|
||
<div class="highlight-bash notranslate"><div class="highlight"><pre><span></span><span class="c1"># From repository root</span>
|
||
tito<span class="w"> </span>module<span class="w"> </span><span class="nb">complete</span><span class="w"> </span><span class="m">03</span>
|
||
</pre></div>
|
||
</div>
|
||
<p>This command:</p>
|
||
<ul class="simple">
|
||
<li><p>Runs tests on your implementation</p></li>
|
||
<li><p>Exports code to <code class="docutils literal notranslate"><span class="pre">tinytorch/nn/layers.py</span></code></p></li>
|
||
<li><p>Makes your code importable</p></li>
|
||
<li><p>Tracks completion</p></li>
|
||
</ul>
|
||
<p><strong>5. Test Your Implementation</strong></p>
|
||
<div class="highlight-bash notranslate"><div class="highlight"><pre><span></span><span class="c1"># Your code is now in the package!</span>
|
||
python<span class="w"> </span>-c<span class="w"> </span><span class="s2">"from tinytorch import Linear; print(Linear(10, 5))"</span>
|
||
</pre></div>
|
||
</div>
|
||
<p><strong>6. Check Progress</strong></p>
|
||
<div class="highlight-bash notranslate"><div class="highlight"><pre><span></span>tito<span class="w"> </span>module<span class="w"> </span>status
|
||
</pre></div>
|
||
</div>
|
||
</div>
|
||
</section>
|
||
<hr class="docutils" />
|
||
<section id="system-commands">
|
||
<h2>System Commands<a class="headerlink" href="#system-commands" title="Link to this heading">#</a></h2>
|
||
<section id="environment-health">
|
||
<h3>Environment Health<a class="headerlink" href="#environment-health" title="Link to this heading">#</a></h3>
|
||
<div style="background: #e3f2fd; padding: 1.5rem; border-radius: 0.5rem; border-left: 4px solid #2196f3; margin: 1.5rem 0;">
|
||
<p><strong>Check Setup (Run This First)</strong></p>
|
||
<div class="highlight-bash notranslate"><div class="highlight"><pre><span></span>tito<span class="w"> </span>system<span class="w"> </span>health
|
||
</pre></div>
|
||
</div>
|
||
<p>Verifies:</p>
|
||
<ul class="simple">
|
||
<li><p>Virtual environment activated</p></li>
|
||
<li><p>Dependencies installed (NumPy, Jupyter, Rich)</p></li>
|
||
<li><p>TinyTorch in development mode</p></li>
|
||
<li><p>All systems ready</p></li>
|
||
</ul>
|
||
<p><strong>Output</strong>:</p>
|
||
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span>✅ Environment validation passed
|
||
• Virtual environment: Active
|
||
• Dependencies: NumPy, Jupyter, Rich installed
|
||
• TinyTorch: Development mode
|
||
</pre></div>
|
||
</div>
|
||
<p><strong>System Information</strong></p>
|
||
<div class="highlight-bash notranslate"><div class="highlight"><pre><span></span>tito<span class="w"> </span>system<span class="w"> </span>info
|
||
</pre></div>
|
||
</div>
|
||
<p>Shows:</p>
|
||
<ul class="simple">
|
||
<li><p>Python version</p></li>
|
||
<li><p>Environment paths</p></li>
|
||
<li><p>Package versions</p></li>
|
||
<li><p>Configuration settings</p></li>
|
||
</ul>
|
||
<p><strong>Start Jupyter Lab</strong></p>
|
||
<div class="highlight-bash notranslate"><div class="highlight"><pre><span></span>tito<span class="w"> </span>system<span class="w"> </span>jupyter
|
||
</pre></div>
|
||
</div>
|
||
<p>Convenience command to launch Jupyter Lab from the correct directory.</p>
|
||
</div>
|
||
</section>
|
||
</section>
|
||
<hr class="docutils" />
|
||
<section id="module-lifecycle-commands">
|
||
<h2>Module Lifecycle Commands<a class="headerlink" href="#module-lifecycle-commands" title="Link to this heading">#</a></h2>
|
||
<section id="start-a-module-first-time">
|
||
<h3>Start a Module (First Time)<a class="headerlink" href="#start-a-module-first-time" title="Link to this heading">#</a></h3>
|
||
<div style="background: #fffbeb; padding: 1.5rem; border-radius: 0.5rem; border-left: 4px solid #f59e0b; margin: 1.5rem 0;">
|
||
<div class="highlight-bash notranslate"><div class="highlight"><pre><span></span>tito<span class="w"> </span>module<span class="w"> </span>start<span class="w"> </span><span class="m">01</span>
|
||
</pre></div>
|
||
</div>
|
||
<p><strong>What this does</strong>:</p>
|
||
<ol class="arabic simple">
|
||
<li><p>Opens Jupyter Lab for Module 01 (Tensor)</p></li>
|
||
<li><p>Shows module README and learning objectives</p></li>
|
||
<li><p>Provides clean starting point</p></li>
|
||
<li><p>Creates backup of any existing work</p></li>
|
||
</ol>
|
||
<p><strong>Example</strong>:</p>
|
||
<div class="highlight-bash notranslate"><div class="highlight"><pre><span></span>tito<span class="w"> </span>module<span class="w"> </span>start<span class="w"> </span><span class="m">05</span><span class="w"> </span><span class="c1"># Start Module 05 (Autograd)</span>
|
||
</pre></div>
|
||
</div>
|
||
<p>Jupyter Lab opens with the generated notebook for Module 05</p>
|
||
</div>
|
||
</section>
|
||
<section id="resume-work-continue-later">
|
||
<h3>Resume Work (Continue Later)<a class="headerlink" href="#resume-work-continue-later" title="Link to this heading">#</a></h3>
|
||
<div style="background: #f3e5f5; padding: 1.5rem; border-radius: 0.5rem; border-left: 4px solid #9c27b0; margin: 1.5rem 0;">
|
||
<div class="highlight-bash notranslate"><div class="highlight"><pre><span></span>tito<span class="w"> </span>module<span class="w"> </span>resume<span class="w"> </span><span class="m">01</span>
|
||
</pre></div>
|
||
</div>
|
||
<p><strong>What this does</strong>:</p>
|
||
<ol class="arabic simple">
|
||
<li><p>Opens Jupyter Lab with your previous work</p></li>
|
||
<li><p>Preserves all your changes</p></li>
|
||
<li><p>Shows where you left off</p></li>
|
||
<li><p>No backup created (you’re continuing)</p></li>
|
||
</ol>
|
||
<p><strong>Use this when</strong>: Coming back to a module you started earlier</p>
|
||
</div>
|
||
</section>
|
||
<section id="complete-export-essential">
|
||
<h3>Complete & Export (Essential)<a class="headerlink" href="#complete-export-essential" title="Link to this heading">#</a></h3>
|
||
<div style="background: #f0fdf4; padding: 1.5rem; border-radius: 0.5rem; border-left: 4px solid #22c55e; margin: 1.5rem 0;">
|
||
<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><span class="m">01</span>
|
||
</pre></div>
|
||
</div>
|
||
<p><strong>THE KEY COMMAND</strong> - This is what makes your code real!</p>
|
||
<p><strong>What this does</strong>:</p>
|
||
<ol class="arabic simple">
|
||
<li><p><strong>Tests</strong> your implementation (inline tests)</p></li>
|
||
<li><p><strong>Exports</strong> to <code class="docutils literal notranslate"><span class="pre">tinytorch/</span></code> package</p></li>
|
||
<li><p><strong>Tracks</strong> completion in <code class="docutils literal notranslate"><span class="pre">.tito/progress.json</span></code></p></li>
|
||
<li><p><strong>Validates</strong> NBGrader metadata</p></li>
|
||
<li><p><strong>Makes read-only</strong> exported files (protection)</p></li>
|
||
</ol>
|
||
<p><strong>Example</strong>:</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><span class="m">05</span><span class="w"> </span><span class="c1"># Export Module 05 (Autograd)</span>
|
||
</pre></div>
|
||
</div>
|
||
<p><strong>After exporting</strong>:</p>
|
||
<div class="highlight-python notranslate"><div class="highlight"><pre><span></span><span class="c1"># YOUR code is now importable!</span>
|
||
<span class="kn">from</span><span class="w"> </span><span class="nn">tinytorch.autograd</span><span class="w"> </span><span class="kn">import</span> <span class="n">backward</span>
|
||
<span class="kn">from</span><span class="w"> </span><span class="nn">tinytorch</span><span class="w"> </span><span class="kn">import</span> <span class="n">Tensor</span>
|
||
|
||
<span class="c1"># Use YOUR implementations</span>
|
||
<span class="n">x</span> <span class="o">=</span> <span class="n">Tensor</span><span class="p">([[</span><span class="mf">1.0</span><span class="p">,</span> <span class="mf">2.0</span><span class="p">]],</span> <span class="n">requires_grad</span><span class="o">=</span><span class="kc">True</span><span class="p">)</span>
|
||
<span class="n">y</span> <span class="o">=</span> <span class="n">x</span> <span class="o">*</span> <span class="mi">2</span>
|
||
<span class="n">y</span><span class="o">.</span><span class="n">backward</span><span class="p">()</span>
|
||
<span class="nb">print</span><span class="p">(</span><span class="n">x</span><span class="o">.</span><span class="n">grad</span><span class="p">)</span> <span class="c1"># Uses YOUR autograd!</span>
|
||
</pre></div>
|
||
</div>
|
||
</div>
|
||
</section>
|
||
<section id="view-progress">
|
||
<h3>View Progress<a class="headerlink" href="#view-progress" title="Link to this heading">#</a></h3>
|
||
<div style="background: #fef3c7; padding: 1.5rem; border-radius: 0.5rem; border-left: 4px solid #f59e0b; margin: 1.5rem 0;">
|
||
<div class="highlight-bash notranslate"><div class="highlight"><pre><span></span>tito<span class="w"> </span>module<span class="w"> </span>status
|
||
</pre></div>
|
||
</div>
|
||
<p><strong>Shows</strong>:</p>
|
||
<ul class="simple">
|
||
<li><p>Which modules (01-20) you’ve completed</p></li>
|
||
<li><p>Completion dates</p></li>
|
||
<li><p>Next recommended module</p></li>
|
||
</ul>
|
||
<p><strong>Example Output</strong>:</p>
|
||
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span>📦 Module Progress
|
||
|
||
✅ Module 01: Tensor (completed 2025-11-16)
|
||
✅ Module 02: Activations (completed 2025-11-16)
|
||
✅ Module 03: Layers (completed 2025-11-16)
|
||
🔒 Module 04: Losses (not started)
|
||
🔒 Module 05: Autograd (not started)
|
||
|
||
Progress: 3/20 modules (15%)
|
||
|
||
Next: Complete Module 04 to continue Foundation Tier
|
||
</pre></div>
|
||
</div>
|
||
</div>
|
||
</section>
|
||
<section id="reset-module-advanced">
|
||
<h3>Reset Module (Advanced)<a class="headerlink" href="#reset-module-advanced" title="Link to this heading">#</a></h3>
|
||
<div style="background: #fff5f5; padding: 1.5rem; border-radius: 0.5rem; border-left: 4px solid #e74c3c; margin: 1.5rem 0;">
|
||
<div class="highlight-bash notranslate"><div class="highlight"><pre><span></span>tito<span class="w"> </span>module<span class="w"> </span>reset<span class="w"> </span><span class="m">01</span>
|
||
</pre></div>
|
||
</div>
|
||
<p><strong>What this does</strong>:</p>
|
||
<ol class="arabic simple">
|
||
<li><p>Creates backup of current work</p></li>
|
||
<li><p>Unexports from <code class="docutils literal notranslate"><span class="pre">tinytorch/</span></code> package</p></li>
|
||
<li><p>Restores module to clean state</p></li>
|
||
<li><p>Removes from completion tracking</p></li>
|
||
</ol>
|
||
<p><strong>Use this when</strong>: You want to start a module completely fresh</p>
|
||
<p>⚠️ <strong>Warning</strong>: This removes your implementation. Use with caution!</p>
|
||
</div>
|
||
</section>
|
||
</section>
|
||
<hr class="docutils" />
|
||
<section id="understanding-the-export-process">
|
||
<h2>Understanding the Export Process<a class="headerlink" href="#understanding-the-export-process" title="Link to this heading">#</a></h2>
|
||
<p>When you run <code class="docutils literal notranslate"><span class="pre">tito</span> <span class="pre">module</span> <span class="pre">complete</span> <span class="pre">XX</span></code>, here’s what happens:</p>
|
||
<div style="background: #f8f9fa; padding: 1.5rem; border: 1px solid #dee2e6; border-radius: 0.5rem; margin: 1.5rem 0;">
|
||
<p><strong>Step 1: Validation</strong></p>
|
||
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span>✓ Checking NBGrader metadata
|
||
✓ Validating Python syntax
|
||
✓ Running inline tests
|
||
</pre></div>
|
||
</div>
|
||
<p><strong>Step 2: Export</strong></p>
|
||
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span>✓ Converting src/XX_name/XX_name.py
|
||
→ modules/XX_name/XX_name.ipynb (notebook)
|
||
→ tinytorch/path/name.py (package)
|
||
✓ Adding "DO NOT EDIT" warning
|
||
✓ Making file read-only
|
||
</pre></div>
|
||
</div>
|
||
<p><strong>Step 3: Tracking</strong></p>
|
||
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span>✓ Recording completion in .tito/progress.json
|
||
✓ Updating module status
|
||
</pre></div>
|
||
</div>
|
||
<p><strong>Step 4: Success</strong></p>
|
||
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span>🎉 Module XX complete!
|
||
Your code is now part of TinyTorch!
|
||
|
||
Import with: from tinytorch import YourClass
|
||
</pre></div>
|
||
</div>
|
||
</div>
|
||
</section>
|
||
<hr class="docutils" />
|
||
<section id="module-structure">
|
||
<h2>Module Structure<a class="headerlink" href="#module-structure" title="Link to this heading">#</a></h2>
|
||
<section id="development-structure">
|
||
<h3>Development Structure<a class="headerlink" href="#development-structure" title="Link to this heading">#</a></h3>
|
||
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span>src/ ← Developer source code
|
||
├── 01_tensor/
|
||
│ └── 01_tensor.py ← SOURCE OF TRUTH (devs edit)
|
||
├── 02_activations/
|
||
│ └── 02_activations.py ← SOURCE OF TRUTH (devs edit)
|
||
└── 03_layers/
|
||
└── 03_layers.py ← SOURCE OF TRUTH (devs edit)
|
||
|
||
modules/ ← Generated notebooks (students use)
|
||
├── 01_tensor/
|
||
│ └── 01_tensor.ipynb ← AUTO-GENERATED for students
|
||
├── 02_activations/
|
||
│ └── 02_activations.ipynb ← AUTO-GENERATED for students
|
||
└── 03_layers/
|
||
└── 03_layers.ipynb ← AUTO-GENERATED for students
|
||
</pre></div>
|
||
</div>
|
||
</section>
|
||
<section id="where-code-exports">
|
||
<h3>Where Code Exports<a class="headerlink" href="#where-code-exports" title="Link to this heading">#</a></h3>
|
||
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span>tinytorch/
|
||
├── core/
|
||
│ └── tensor.py ← AUTO-GENERATED (DO NOT EDIT)
|
||
├── nn/
|
||
│ ├── activations.py ← AUTO-GENERATED (DO NOT EDIT)
|
||
│ └── layers.py ← AUTO-GENERATED (DO NOT EDIT)
|
||
└── ...
|
||
</pre></div>
|
||
</div>
|
||
<p><strong>IMPORTANT</strong>: Understanding the flow</p>
|
||
<ul class="simple">
|
||
<li><p><strong>Developers</strong>: Edit <code class="docutils literal notranslate"><span class="pre">src/XX_name/XX_name.py</span></code> → Run <code class="docutils literal notranslate"><span class="pre">tito</span> <span class="pre">source</span> <span class="pre">export</span></code> → Generates notebooks & package</p></li>
|
||
<li><p><strong>Students</strong>: Work in generated <code class="docutils literal notranslate"><span class="pre">modules/XX_name/XX_name.ipynb</span></code> notebooks</p></li>
|
||
<li><p><strong>Never edit</strong> <code class="docutils literal notranslate"><span class="pre">tinytorch/</span></code> directly - it’s auto-generated</p></li>
|
||
<li><p>Changes in <code class="docutils literal notranslate"><span class="pre">tinytorch/</span></code> will be lost on re-export</p></li>
|
||
</ul>
|
||
</section>
|
||
</section>
|
||
<hr class="docutils" />
|
||
<section id="troubleshooting">
|
||
<h2>Troubleshooting<a class="headerlink" href="#troubleshooting" title="Link to this heading">#</a></h2>
|
||
<section id="environment-not-ready">
|
||
<h3>Environment Not Ready<a class="headerlink" href="#environment-not-ready" title="Link to this heading">#</a></h3>
|
||
<div style="background: #fff5f5; padding: 1.5rem; border: 1px solid #fed7d7; border-radius: 0.5rem; margin: 1rem 0;">
|
||
<p><strong>Problem</strong>: <code class="docutils literal notranslate"><span class="pre">tito</span> <span class="pre">system</span> <span class="pre">health</span></code> shows errors</p>
|
||
<p><strong>Solution</strong>:</p>
|
||
<div class="highlight-bash notranslate"><div class="highlight"><pre><span></span><span class="c1"># Re-run setup</span>
|
||
./setup-environment.sh
|
||
<span class="nb">source</span><span class="w"> </span>activate.sh
|
||
|
||
<span class="c1"># Verify</span>
|
||
tito<span class="w"> </span>system<span class="w"> </span>health
|
||
</pre></div>
|
||
</div>
|
||
</div>
|
||
</section>
|
||
<section id="export-fails">
|
||
<h3>Export Fails<a class="headerlink" href="#export-fails" title="Link to this heading">#</a></h3>
|
||
<div style="background: #fff5f5; padding: 1.5rem; border: 1px solid #fed7d7; border-radius: 0.5rem; margin: 1rem 0;">
|
||
<p><strong>Problem</strong>: <code class="docutils literal notranslate"><span class="pre">tito</span> <span class="pre">module</span> <span class="pre">complete</span> <span class="pre">XX</span></code> fails</p>
|
||
<p><strong>Common causes</strong>:</p>
|
||
<ol class="arabic simple">
|
||
<li><p>Syntax errors in your code</p></li>
|
||
<li><p>Failing tests</p></li>
|
||
<li><p>Missing required functions</p></li>
|
||
</ol>
|
||
<p><strong>Solution</strong>:</p>
|
||
<ol class="arabic simple">
|
||
<li><p>Check error message for details</p></li>
|
||
<li><p>Fix issues in <code class="docutils literal notranslate"><span class="pre">modules/XX_name/</span></code></p></li>
|
||
<li><p>Test in Jupyter Lab first</p></li>
|
||
<li><p>Re-run <code class="docutils literal notranslate"><span class="pre">tito</span> <span class="pre">module</span> <span class="pre">complete</span> <span class="pre">XX</span></code></p></li>
|
||
</ol>
|
||
</div>
|
||
</section>
|
||
<section id="import-errors">
|
||
<h3>Import Errors<a class="headerlink" href="#import-errors" title="Link to this heading">#</a></h3>
|
||
<div style="background: #fff5f5; padding: 1.5rem; border: 1px solid #fed7d7; border-radius: 0.5rem; margin: 1rem 0;">
|
||
<p><strong>Problem</strong>: <code class="docutils literal notranslate"><span class="pre">from</span> <span class="pre">tinytorch</span> <span class="pre">import</span> <span class="pre">X</span></code> fails</p>
|
||
<p><strong>Solution</strong>:</p>
|
||
<div class="highlight-bash notranslate"><div class="highlight"><pre><span></span><span class="c1"># Re-export the module</span>
|
||
tito<span class="w"> </span>module<span class="w"> </span><span class="nb">complete</span><span class="w"> </span>XX
|
||
|
||
<span class="c1"># Test import</span>
|
||
python<span class="w"> </span>-c<span class="w"> </span><span class="s2">"from tinytorch import Tensor"</span>
|
||
</pre></div>
|
||
</div>
|
||
</div>
|
||
<p>See <a class="reference internal" href="troubleshooting.html"><span class="std std-doc">Troubleshooting Guide</span></a> for more issues and solutions.</p>
|
||
</section>
|
||
</section>
|
||
<hr class="docutils" />
|
||
<section id="next-steps">
|
||
<h2>Next Steps<a class="headerlink" href="#next-steps" title="Link to this heading">#</a></h2>
|
||
<div style="background: #f8f9fa; padding: 2rem; border-radius: 0.5rem; margin: 2rem 0; text-align: center;">
|
||
<h3 style="margin: 0 0 1rem 0; color: #495057;">Ready to Build Your First Module?</h3>
|
||
<p style="margin: 0 0 1.5rem 0; color: #6c757d;">Start with Module 01 (Tensor) and build the foundation of neural networks</p>
|
||
<a href="../tiers/foundation.html" style="display: inline-block; background: #007bff; color: white; padding: 0.75rem 1.5rem; border-radius: 0.25rem; text-decoration: none; font-weight: 500; margin-right: 1rem;">Foundation Tier →</a>
|
||
<a href="milestones.html" style="display: inline-block; background: #9c27b0; color: white; padding: 0.75rem 1.5rem; border-radius: 0.25rem; text-decoration: none; font-weight: 500;">Milestone System →</a>
|
||
</div>
|
||
<hr class="docutils" />
|
||
<p><em>The module workflow is the heart of TinyTorch. Master these commands and you’ll build ML systems with confidence. Every line of code you write becomes part of a real, working framework.</em></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: "./tito"
|
||
},
|
||
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="overview.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">TITO Command Reference</p>
|
||
</div>
|
||
</a>
|
||
<a class="right-next"
|
||
href="milestones.html"
|
||
title="next page">
|
||
<div class="prev-next-info">
|
||
<p class="prev-next-subtitle">next</p>
|
||
<p class="prev-next-title">Milestone System</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-workflow">The Core Workflow</a></li>
|
||
<li class="toc-h2 nav-item toc-entry"><a class="reference internal nav-link" href="#essential-commands">Essential Commands</a></li>
|
||
<li class="toc-h2 nav-item toc-entry"><a class="reference internal nav-link" href="#typical-development-session">Typical Development Session</a></li>
|
||
<li class="toc-h2 nav-item toc-entry"><a class="reference internal nav-link" href="#system-commands">System Commands</a><ul class="nav section-nav flex-column">
|
||
<li class="toc-h3 nav-item toc-entry"><a class="reference internal nav-link" href="#environment-health">Environment Health</a></li>
|
||
</ul>
|
||
</li>
|
||
<li class="toc-h2 nav-item toc-entry"><a class="reference internal nav-link" href="#module-lifecycle-commands">Module Lifecycle Commands</a><ul class="nav section-nav flex-column">
|
||
<li class="toc-h3 nav-item toc-entry"><a class="reference internal nav-link" href="#start-a-module-first-time">Start a Module (First Time)</a></li>
|
||
<li class="toc-h3 nav-item toc-entry"><a class="reference internal nav-link" href="#resume-work-continue-later">Resume Work (Continue Later)</a></li>
|
||
<li class="toc-h3 nav-item toc-entry"><a class="reference internal nav-link" href="#complete-export-essential">Complete & Export (Essential)</a></li>
|
||
<li class="toc-h3 nav-item toc-entry"><a class="reference internal nav-link" href="#view-progress">View Progress</a></li>
|
||
<li class="toc-h3 nav-item toc-entry"><a class="reference internal nav-link" href="#reset-module-advanced">Reset Module (Advanced)</a></li>
|
||
</ul>
|
||
</li>
|
||
<li class="toc-h2 nav-item toc-entry"><a class="reference internal nav-link" href="#understanding-the-export-process">Understanding the Export Process</a></li>
|
||
<li class="toc-h2 nav-item toc-entry"><a class="reference internal nav-link" href="#module-structure">Module Structure</a><ul class="nav section-nav flex-column">
|
||
<li class="toc-h3 nav-item toc-entry"><a class="reference internal nav-link" href="#development-structure">Development Structure</a></li>
|
||
<li class="toc-h3 nav-item toc-entry"><a class="reference internal nav-link" href="#where-code-exports">Where Code Exports</a></li>
|
||
</ul>
|
||
</li>
|
||
<li class="toc-h2 nav-item toc-entry"><a class="reference internal nav-link" href="#troubleshooting">Troubleshooting</a><ul class="nav section-nav flex-column">
|
||
<li class="toc-h3 nav-item toc-entry"><a class="reference internal nav-link" href="#environment-not-ready">Environment Not Ready</a></li>
|
||
<li class="toc-h3 nav-item toc-entry"><a class="reference internal nav-link" href="#export-fails">Export Fails</a></li>
|
||
<li class="toc-h3 nav-item toc-entry"><a class="reference internal nav-link" href="#import-errors">Import Errors</a></li>
|
||
</ul>
|
||
</li>
|
||
<li class="toc-h2 nav-item toc-entry"><a class="reference internal nav-link" href="#next-steps">Next Steps</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> |