### Install Anneal CLI
Source: https://github.com/georgebuilds/anneal/blob/main/docs/index.html
Install the Anneal command-line interface using go get.
```bash
go get github.com/georgebuilds/anneal
```
--------------------------------
### Run Deno Example
Source: https://github.com/georgebuilds/anneal/blob/main/node_modules/@resvg/resvg-js/README.md
Execute the Deno example script with necessary permissions to render an SVG to PNG.
```shell
deno run --unstable --allow-read --allow-write --allow-ffi example/index-deno.js
```
--------------------------------
### Install anneal CLI
Source: https://github.com/georgebuilds/anneal/blob/main/README.md
Install the anneal command-line interface using go install. Alternatively, build from a cloned repository.
```bash
go install github.com/georgebuilds/anneal/cmd/anneal@latest
```
```bash
git clone https://github.com/georgebuilds/anneal && cd anneal
go build ./cmd/anneal
```
--------------------------------
### Install Rust, Node.js, and wasm-pack
Source: https://github.com/georgebuilds/anneal/blob/main/node_modules/@resvg/resvg-js/README.md
Instructions for setting up the development environment by installing Rust, Node.js, and wasm-pack. This includes commands for installing wasm-pack and its dependency wasm-bindgen.
```bash
curl https://rustwasm.github.io/wasm-pack/installer/init.sh -sSf | sh
```
```bash
cargo install wasm-bindgen-cli
```
```bash
brew install binaryen
```
--------------------------------
### Benchmark Setup and Execution
Source: https://github.com/georgebuilds/anneal/blob/main/node_modules/@resvg/resvg-js/README.md
Install dependencies and run a benchmark script to compare Resvg.js performance against other libraries like sharp and svg2img.
```shell
npm i benny@3.x sharp@0.x @types/sharp svg2img@0.x
npm run bench
```
--------------------------------
### Run Node.js Example
Source: https://github.com/georgebuilds/anneal/blob/main/node_modules/@resvg/resvg-js/README.md
Execute the Node.js example script to see resvg-js in action, including font loading and SVG to PNG conversion.
```shell
node example/index.js
```
--------------------------------
### Run Node.js Example with Bun
Source: https://github.com/georgebuilds/anneal/blob/main/node_modules/@resvg/resvg-js/README.md
Execute the Node.js example script directly using Bun, leveraging its compatibility with Node.js syntax.
```shell
bun example/index.js
```
--------------------------------
### Setup and Build anneal Project
Source: https://github.com/georgebuilds/anneal/blob/main/CONTRIBUTING.md
Clone the repository, build all Go packages, and run tests. This snippet also shows how to check for WebGPU device reachability.
```bash
git clone https://github.com/georgebuilds/anneal && cd anneal
go build ./...
go test ./...
go run ./cmd/anneal doctor # confirm a WebGPU device is reachable
```
--------------------------------
### Launch Graph Visualizer with Anneal CLI
Source: https://github.com/georgebuilds/anneal/blob/main/docs/index.html
Start the graph visualizer in a web browser using WebAssembly.
```bash
anneal viz
```
--------------------------------
### MLP Training Example Output
Source: https://github.com/georgebuilds/anneal/blob/main/docs/index.html
Example output from the 'anneal train mlp' command, showing device, step, loss, accuracy, and fused kernel information.
```bash
anneal train mlp
device webgpu · apple m3 max
step 001 loss 2.3194 acc 0.09
step 100 loss 0.8271 acc 0.74
forward 14 uops backward 11 uops → fused 3 kernels
```
--------------------------------
### Install resvg-js for Node.js
Source: https://github.com/georgebuilds/anneal/blob/main/node_modules/@resvg/resvg-js/README.md
Use npm to install the resvg-js package for Node.js environments.
```shell
npm i @resvg/resvg-js
```
--------------------------------
### Explain Canonicalization Rewrite
Source: https://github.com/georgebuilds/anneal/blob/main/docs/index.html
Example output from 'anneal explain mul', demonstrating the canonicalization rewrite rule for multiplication.
```bash
anneal explain mul
symbolic x * y → y * x canonicalization
```
--------------------------------
### Resvg.js Deno Example
Source: https://github.com/georgebuilds/anneal/blob/main/node_modules/@resvg/resvg-js/README.md
A Deno script demonstrating how to read an SVG file, configure Resvg.js options, render it to PNG, and write the output to a file.
```javascript
import * as path from 'https://deno.land/std@0.159.0/path/mod.ts'
import { Resvg } from 'npm:@resvg/resvg-js'
const __dirname = path.dirname(path.fromFileUrl(import.meta.url))
const svg = await Deno.readFile(path.join(__dirname, './text.svg'))
const opts = {
fitTo: {
mode: 'width',
value: 1200,
},
}
const t = performance.now()
const resvg = new Resvg(svg, opts)
const pngData = resvg.render()
const pngBuffer = pngData.asPng()
console.info('Original SVG Size:', `${resvg.width} x ${resvg.height}`)
console.info('Output PNG Size :', `${pngData.width} x ${pngData.height}`)
console.info('✨ Done in', performance.now() - t, 'ms')
await Deno.writeFile(path.join(__dirname, './text-out-deno.png'), pngBuffer)
```
--------------------------------
### Node.js Usage: Render SVG to PNG with Options
Source: https://github.com/georgebuilds/anneal/blob/main/node_modules/@resvg/resvg-js/README.md
This Node.js example demonstrates how to read an SVG file, configure rendering options (background, fitTo, fonts), render it to PNG, and save the output. It also logs the original and output dimensions.
```javascript
const { promises } = require('fs')
const { join } = require('path')
const { Resvg } = require('@resvg/resvg-js')
async function main() {
const svg = await promises.readFile(join(__dirname, './text.svg'))
const opts = {
background: 'rgba(238, 235, 230, .9)',
fitTo: {
mode: 'width',
value: 1200,
},
font: {
fontFiles: ['./example/SourceHanSerifCN-Light-subset.ttf'], // Load custom fonts.
loadSystemFonts: false, // It will be faster to disable loading system fonts.
// defaultFontFamily: 'Source Han Serif CN Light', // You can omit this.
},
}
const resvg = new Resvg(svg, opts)
const pngData = resvg.render()
const pngBuffer = pngData.asPng()
console.info('Original SVG Size:', `${resvg.width} x ${resvg.height}`)
console.info('Output PNG Size :', `${pngData.width} x ${pngData.height}`)
await promises.writeFile(join(__dirname, './text-out.png'), pngBuffer)
}
main()
```
--------------------------------
### Build Node.js Bindings
Source: https://github.com/georgebuilds/anneal/blob/main/node_modules/@resvg/resvg-js/README.md
Steps to build the Node.js bindings for Resvg.js. This involves installing dependencies, building the project, and running tests.
```bash
npm i
npm run build
npm test
```
--------------------------------
### Explain Multiplicative Identity Rewrite
Source: https://github.com/georgebuilds/anneal/blob/main/docs/index.html
Example output from 'anneal explain mul', showing the rewrite rule for the multiplicative identity.
```bash
anneal explain mul
symbolic x * 1 → x multiplicative identity
```
--------------------------------
### Build WebAssembly Bindings
Source: https://github.com/georgebuilds/anneal/blob/main/node_modules/@resvg/resvg-js/README.md
Steps to build the WebAssembly bindings for Resvg.js. This includes installing dependencies, building the WASM module, and running WASM-specific tests.
```bash
npm i
npm run build:wasm
npm run test:wasm
```
--------------------------------
### Resvg.js WebAssembly in Browser
Source: https://github.com/georgebuilds/anneal/blob/main/node_modules/@resvg/resvg-js/README.md
Integrate Resvg.js WebAssembly into an HTML page to render SVG to PNG. This example shows how to initialize the Wasm module, load custom fonts, and display the output.
```html
```
--------------------------------
### Benchmark Results
Source: https://github.com/georgebuilds/anneal/blob/main/node_modules/@resvg/resvg-js/README.md
Sample output from a benchmark comparing rendering speeds of different libraries for the 'resize width' operation.
```shell
Running "resize width" suite...
resvg-js(Rust):
12 ops/s
sharp:
9 ops/s
skr-canvas(Rust):
7 ops/s
svg2img(canvg and node-canvas):
6 ops/s
```
--------------------------------
### Basic tensor operations with anneal
Source: https://github.com/georgebuilds/anneal/blob/main/README.md
Demonstrates the basic tensor API, including performing a backward pass and realizing the computation. Assumes a model and forward pass producing 'loss' are already set up.
```go
import "github.com/georgebuilds/anneal/tensor"
// ... build a model and a forward pass producing `loss` ...
loss.Backward() // injects gradient UOps into the same graph (teal → ember)
loss.Realize() // schedule, fuse across the seam (gold), compile to WGSL, run
```
--------------------------------
### Check Backend Environment with Anneal CLI
Source: https://github.com/georgebuilds/anneal/blob/main/docs/index.html
Perform a check of the WebGPU and backend environment configuration.
```bash
anneal doctor
```
--------------------------------
### Show Generated WGSL Kernels with Anneal CLI
Source: https://github.com/georgebuilds/anneal/blob/main/docs/index.html
Display the generated WebGPU Shading Language (WGSL) code, annotating fusion boundaries.
```bash
anneal kernels
```
--------------------------------
### WebGPU Backend Structure
Source: https://github.com/georgebuilds/anneal/blob/main/SPEC.md
Illustrates the directory structure for the WebGPU backend within the Anneal project. It outlines the purpose of each subdirectory related to UOp, rewrite, shape, schedule, codegen, and backend components.
```text
uop/ UOp struct, arena, interning, Ops enum, dtype, KernelInfo,
StructuralKeys, DefineVar/Bind constructors
rewrite/ PatternMatcher, UPat DSL, graph_rewrite driver
gen/ .upat → .go codegen
rules/ symbolic.upat (source of truth), symbolic_gen.go (generated),
symbolic.go, alu.go, bounds.go
NOTE: gradient rules live in tensor/gradient.go (§5), not here
NOTE: scheduler passes use direct Go functions, not PatternMatcher rulesets
shape/ View, ShapeTracker, movement ops, Sint seam (sint.go)
schedule/ rangeify, realize-map, bufferize, kernel split, toposort,
memory plan, stats hook, structural-key-ordered scheduling,
schedule cache (cache.go)
codegen/ lower.go (→ []Instr linearisation), wgsl.go (WGSL renderer)
backend/ device abstraction
webgpu/ open.go (locked GPU-owner goroutine), executor.go,
symbolic dispatch path (RunSymbolic + compile-once cache)
tensor/ Tensor API, ops, movement, gradient, realize, jit
nn/ Linear, Conv2d, activations, SGD, Parameter
npy/ .npy/.npz ingestion (pure Go)
safetensors/ .safetensors save+load (pure Go, bidirectional w/ Python lib)
cmd/anneal/ CLI (run/train/graph/kernels/explain/doctor/viz verbs)
tui/ bubbletea/lipgloss train dashboard
viz/ visualizer
examples/ mlp.go, conv.go, dynmlp.go (dynamic-batch)
docs/ GitHub Pages site (bilingual en/es)
Module path: github.com/georgebuilds/anneal
```
--------------------------------
### Run a Model with Anneal CLI
Source: https://github.com/georgebuilds/anneal/blob/main/docs/index.html
Execute a realized graph using the 'run' verb.
```bash
anneal run
```
--------------------------------
### Explain an Operation with Anneal CLI
Source: https://github.com/georgebuilds/anneal/blob/main/docs/index.html
Trace the rewrite rules that are applied to a specific operator.
```bash
anneal explain
```
--------------------------------
### Train MLP with Anneal CLI
Source: https://github.com/georgebuilds/anneal/blob/main/docs/index.html
Initiate a training loop for a Multi-Layer Perceptron (MLP) with the live TUI.
```bash
anneal train mlp
```
--------------------------------
### Dump and Inspect UOp DAG with Anneal CLI
Source: https://github.com/georgebuilds/anneal/blob/main/docs/index.html
Output and examine the Unoptimized Operator Directed Acyclic Graph (DAG) for a given model.
```bash
anneal graph
```
--------------------------------
### Tensor JIT Capture and Replay
Source: https://github.com/georgebuilds/anneal/blob/main/SPEC.md
Captures the frozen execution plan on the first call and replays subsequent calls without rebuilding the graph. Replay re-uploads current Parameter.Value data into recorded buffer slots.
```go
func (t *Tensor) JIT() *Tensor
```
--------------------------------
### Run anneal CLI commands
Source: https://github.com/georgebuilds/anneal/blob/main/README.md
Execute various anneal CLI commands for environment checks, training, graph visualization, kernel inspection, and op explanation.
```bash
anneal doctor # check your environment can reach a WebGPU device
anneal train mlp # train the MLP with a live TUI dashboard (also: conv, dynmlp --batch=N)
anneal graph # dump the UOp graph for a program
anneal kernels # show the scheduled, fused kernels and their WGSL
anneal explain add # explain the rewrite/gradient rules for an op
```
--------------------------------
### Theme Management Script
Source: https://github.com/georgebuilds/anneal/blob/main/docs/index.html
This JavaScript snippet initializes the theme based on local storage or system preferences, preventing FOUC (Flash of Unstyled Content).
```javascript
(function () { var t = localStorage.getItem("anneal-theme"); if (!t) t = window.matchMedia("(prefers-color-scheme:light)") .matches ? "light" : "dark"; document.documentElement.setAttribute("data-theme", t); })();
```
--------------------------------
### CSS Reset and Base Styles
Source: https://github.com/georgebuilds/anneal/blob/main/docs/index.html
Basic CSS for resetting default browser styles and setting up base properties for the HTML and body elements.
```css
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
```
```css
html { scroll-behavior: smooth; }
```
```css
body { background: var(--bg); color: var(--text); font-family: var(--mono); font-size: 14px; line-height: 1.7; -webkit-font-smoothing: antialiased; overflow-x: hidden; transition: background 0.2s ease, color 0.2s ease; }
```
--------------------------------
### nn.Parameter Load Method
Source: https://github.com/georgebuilds/anneal/blob/main/SPEC.md
Copies the parameter's value into a new OpBuffer leaf within the specified arena. This is used to create a fresh leaf for the parameter in a new arena.
```go
func (p *Parameter) Load(a *Arena) *Tensor
```
--------------------------------
### Brand Separator and Project Name Styles
Source: https://github.com/georgebuilds/anneal/blob/main/docs/index.html
CSS for the separator between brand elements and the project name, ensuring consistent styling.
```css
.brand-sep { color: var(--faint); margin: 0 0.35em; user-select: none; }
```
```css
.proj-name { color: var(--text)
```
--------------------------------
### Header Styles
Source: https://github.com/georgebuilds/anneal/blob/main/docs/index.html
CSS for the sticky header, including its layout, background with blur effect, and bottom border.
```css
header { position: sticky; top: 0; z-index: 100; display: flex; align-items: center; justify-content: space-between; padding: 0 clamp(1.5rem, 5vw, 3rem); height: 52px; background: var(--bg-glass); backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px); border-bottom: 1px solid var(--faint); transition: background 0.2s ease, border-color 0.2s ease; }
```
--------------------------------
### Light Mode Design Tokens (Media Query)
Source: https://github.com/georgebuilds/anneal/blob/main/docs/index.html
Defines CSS variables for light mode using a media query for system preference, overriding dark mode tokens.
```css
@media (prefers-color-scheme: light) { :root:not(\[data-theme\]) { --bg: #fbf8f3; --surface: #ede8e0; --text: #14110f; --muted: #5c4e3f; --faint: #9a8f85; --bg-glass: rgba(251, 248, 243, 0.88); --teal-tx: #0078a0; /* WCAG AA on #FBF8F3 */ --ember-tx: #c03a00; --gold-tx: #8b5e10; } }
```
--------------------------------
### Brand Abbreviation and Full Name Transitions
Source: https://github.com/georgebuilds/anneal/blob/main/docs/index.html
CSS for animating the display of brand abbreviations and full names on hover or focus, creating a smooth reveal effect.
```css
.gb-abbr, .gb-full { display: inline-block; overflow: hidden; white-space: nowrap; max-width: 0; opacity: 0; transition: max-width 0.42s cubic-bezier(0.22, 0.9, 0.25, 1), opacity 0.25s ease; }
```
```css
.gb-abbr { max-width: 4ch; opacity: 1; }
```
```css
.gb-link:hover .gb-abbr, .gb-link:focus-visible .gb-abbr { max-width: 0; opacity: 0; }
```
```css
.gb-link:hover .gb-full, .gb-link:focus-visible .gb-full { max-width: 14ch; opacity: 1; transition-delay: 0.04s; }
```
--------------------------------
### nn.Parameter SGDStep Method
Source: https://github.com/georgebuilds/anneal/blob/main/SPEC.md
Applies an in-place SGD update to the parameter's value. This method requires the gradient to be realized before applying the update.
```go
func (p *Parameter) SGDStep(grad []float32, lr float32)
```
--------------------------------
### JavaScript Copy to Clipboard Functionality
Source: https://github.com/georgebuilds/anneal/blob/main/docs/index.html
Implements a copy-to-clipboard feature for a command string using the Clipboard API. Provides visual feedback on success.
```javascript
var installRow = document.getElementById("js-install"); var copyBtn = document.getElementById("js-copy"); var copyLive = document.getElementById("js-copy-live"); var CMD = "go get github.com/georgebuilds/anneal"; function doCopy() { if (!navigator.clipboard) return; navigator.clipboard.writeText(CMD).then(function () { var done = T[currentLang]["install.copied"]; copyBtn.textContent = done; copyBtn.style.color = "var(--gold-tx)"; copyLive.textContent = done; setTimeout(function () { copyBtn.textContent = T[currentLang]["install.copy"]; copyBtn.style.color = ""; copyLive.textContent = ""; }, 2200); }); } copyBtn.addEventListener("click", function (e) { e.stopPropagation(); doCopy(); }); installRow.addEventListener("click", doCopy);
```
--------------------------------
### View and ShapeTracker Structs
Source: https://github.com/georgebuilds/anneal/blob/main/SPEC.md
Defines the structure for View and ShapeTracker, used for managing tensor shapes and views. ShapeTracker uses a stack of Views to represent transformations.
```go
type View struct {
Shape []Sint
Strides []Sint
Offset Sint
Mask [][2]Sint
Contiguous bool
}
type ShapeTracker struct {
Views []View
}
```
--------------------------------
### JavaScript for Translations and Theme Toggling
Source: https://github.com/georgebuilds/anneal/blob/main/docs/index.html
This JavaScript code handles translations, language switching, and theme toggling (light/dark mode) for the anneal project's UI.
```javascript
(function () {
"use strict";
/* ─── Translations ──────────────────────────────────────────── */
var T = {
en: {
skip: "skip to main content",
"nav.how": "how it works",
"nav.github": "github",
"lang.switch": "ES",
"lang.label": "Switch to Spanish",
"theme.to-light": "Switch to light mode",
"theme.to-dark": "Switch to dark mode",
"page.title": "anneal — autodiff is a compiler pass",
"hero.tagline": "Autodiff is a compiler pass.",
"hero.disambig": "a Go tensor compiler",
"install.copy": "copy",
"install.copied": "copied",
"arch.label": "how it works",
"arch.heading": "One graph, fully fused.",
"arch.body": "Autodiff and optimization are first-class compiler passes over one immutable UOp IR — not runtime hooks bolted onto a separate tape. Per-op gradient rules are dispatched through a drift-checked ruleset, producing a uniform, fusible backward graph. The scheduler sees the whole computation, forward and backward together, and fuses across that boundary as a natural consequence.",
"leg.teal": "teal — forward pass (solid)",
"leg.ember": "ember — backward pass (dashed)",
"leg.gold": "gold — fused kernel",
"card.fwd.tag": "forward pass",
"card.fwd.title": "An immutable UOp DAG",
"card.fwd.body": "Every operation is a node in a shared arena — interned, never mutated. Rewrites produce new nodes. Structural equality is identity equality; no deep comparisons in hot paths.",
"card.bwd.tag": "backward pass",
"card.bwd.title": "Autodiff as a compiler pass",
"card.bwd.body": "Gradient computation is a typed compiler pass that walks the forward graph and emits backward UOps via a ruleset drift-checked against curated documentation. The gradient graph lives alongside the forward graph, with per-node rule attribution visible in the visualizer, until the scheduler decides what to fuse.",
"card.fsd.tag": "fused kernel",
"card.fsd.title": "Fusion across the boundary",
"card.fsd.body": "The rangeify scheduler sees forward and backward together. It can fuse across that boundary — collapsing both into a single WGSL kernel that a backend-aware scheduler would never produce.",
"card.rt.tag": "runtime",
"card.rt.title": "Dynamic batch, JIT, f16/bf16 support",
"card.rt.body": "The batch dimension can be symbolic: a kernel compiles once and runs at any batch size. f16 support (narrowing uses IEEE 754 RTNE) and bf16 storage-only enable low-precision workflows. tensor.JIT captures the execution plan; the scheduler is memoized on a structural key.",
"cli.label": "the cli",
"cli.heading": "Verbs that mirror the pipeline.",
"cli.body": "A single static binary, verb-first. Each command exposes a layer of the compiler so the CLI doubles as a teaching surface.",
"cli.run": "realize and execute a registered example graph",
"cli.train": "training loop with the live TUI (mlp / conv / dynmlp)",
"cli.viz": "launch the graph visualizer in-browser (WASM)",
"cli.graph": "dump and inspect the UOp DAG",
"cli.kernels": "show generated WGSL with fusion boundaries annotated",
"cli.explain": "trace the rewrite rules that fire for one op",
"cli.doctor": "WebGPU / backend environment check",
"cli.interop": "The tensor/npy and tensor/safetensors packages load .npy/.npz arrays and read/write .safetensors checkpoints in pure Go — no Python dependency at runtime.",
"phil.label": "design",
"phil.heading": "No shortcuts.",
"phil.body": "The graph-rewrite approach to tensor compilation is proven. Anneal's contribution is rigor, ergonomics, and a visualizer that shows you what the compiler is actually doing — compiled to WASM, running in your browser, not a mock.",
"phil.ir.h": "One immutable IR",
"phil.ir.b": "UOps are interned, arena-allocated, and never mutated. Every rewrite produces a new node. Structural equality is identity equality — no deep comparisons in hot paths, no GC pressure from temporary objects.",
"phil.refl.h": "No reflection in the rewrite path",
"phil.refl.b": "A hard invariant. Pattern matching against the IR uses typed accessors, not runtime introspection. The hot path stays predictable, verifiable, and fast.",
"phil.viz.h": "The visualizer runs the real compiler",
"phil.viz.b": "anneal viz compiles the frontend and rewrite engine to WASM and renders the actual UOp graph in-browser. JSON output carries per-node rule attribution. The marketing artifact and the integration test for th"
}
};
})();
```
--------------------------------
### Skip Link Styles
Source: https://github.com/georgebuilds/anneal/blob/main/docs/index.html
CSS for a skip link, providing accessibility by allowing keyboard users to bypass navigation links.
```css
.skip-link { position: absolute; top: -100%; left: 1rem; z-index: 200; background: var(--surface); color: var(--text); border: 1px solid var(--teal); border-radius: 4px; padding: 0.5rem 1rem; font-family: var(--mono); font-size: 0.82rem; text-decoration: none; transition: top 0.15s ease; }
```
```css
.skip-link:focus { top: 0.75rem; }
```
--------------------------------
### Incrementing Package Version with npm
Source: https://github.com/georgebuilds/anneal/blob/main/node_modules/@resvg/resvg-js/README.md
Use npm commands to increment the package version for releases. 'patch' increments the last digit (e.g., 1.0.0 to 1.0.1), while 'minor' increments the middle digit (e.g., 1.0.0 to 1.1.0).
```bash
# 1.0.0 => 1.0.1
npm version patch
# or 1.0.0 => 1.1.0
npm version minor
```
--------------------------------
### Anneal Software Application Schema
Source: https://github.com/georgebuilds/anneal/blob/main/docs/index.html
A JSON-LD schema defining the Anneal software application, including its name, category, programming language, OS, description, and author.
```json
{ "@context": "https://schema.org", "@type": "SoftwareApplication", "name": "anneal", "applicationCategory": "DeveloperApplication", "programmingLanguage": { "@type": "ComputerLanguage", "name": "Go" }, "operatingSystem": "Linux, macOS, Windows", "description": "A Go tensor compiler. Autodiff and optimization as first-class compiler passes over one immutable UOp IR. The scheduler fuses across the forward/backward boundary.", "url": "https://georgebuilds.github.io/anneal/", "author": { "@type": "Organization", "name": "georgebuilds", "url": "https://georgebuilds.github.io/" }, "license": "https://opensource.org/license/agpl-3-0", "offers": { "@type": "Offer", "price": "0", "priceCurrency": "USD" }, "keywords": "tensor compiler, autodiff, GPU, WebGPU, Go, machine learning, graph rewrite, WGSL" }
```
--------------------------------
### Brand Link Styles
Source: https://github.com/georgebuilds/anneal/blob/main/docs/index.html
CSS for the brand link within the header, controlling its display, alignment, and hover effects.
```css
.brand { display: inline-flex; align-items: center; font-size: 13px; letter-spacing: 0.01em; }
```
```css
.gb-link { display: inline-flex; align-items: center; color: var(--muted); text-decoration: none; transition: color 0.25s ease; }
```
```css
.gb-link:hover, .gb-link:focus-visible { color: var(--text); }
```
--------------------------------
### Focus Indicator Styles
Source: https://github.com/georgebuilds/anneal/blob/main/docs/index.html
CSS to provide a clear visual focus indicator for interactive elements, enhancing accessibility.
```css
:focus-visible { outline: 2px solid var(--teal); outline-offset: 3px; border-radius: 2px; }
```
--------------------------------
### Include resvg-wasm for Browser
Source: https://github.com/georgebuilds/anneal/blob/main/node_modules/@resvg/resvg-js/README.md
Include the resvg-wasm script tag in your HTML to use resvg-js in the browser.
```html
```
--------------------------------
### Light Mode Design Tokens (Attribute Selector)
Source: https://github.com/georgebuilds/anneal/blob/main/docs/index.html
Defines CSS variables for light mode using an attribute selector for explicit theme setting, overriding dark mode tokens.
```css
\[data-theme="light""] { --bg: #fbf8f3; --surface: #ede8e0; --text: #14110f; --muted: #5c4e3f; --faint: #9a8f85; --bg-glass: rgba(251, 248, 243, 0.88); --teal-tx: #0078a0; --ember-tx: #c03a00; --gold-tx: #8b5e10; }
```
--------------------------------
### JavaScript Hero Fade-ins
Source: https://github.com/georgebuilds/anneal/blob/main/docs/index.html
Applies a 'visible' class to specific elements for fade-in animations when they are ready.
```javascript
[ "js-wordmark", "js-tagline", "js-disambig", "js-install", ].forEach(function (id) { document.getElementById(id).classList.add("visible"); });
```
--------------------------------
### JavaScript Animation Logic
Source: https://github.com/georgebuilds/anneal/blob/main/docs/index.html
Contains logic for animating elements like arcs and dots based on time progression. It uses requestAnimationFrame for smooth updates.
```javascript
eDashoffset = emberLen * (1 - easeOut(Math.min(et / ARC_DUR, 1))); if (t > ARC_OFFSET) emberDot.style.opacity = String( Math.min((t - ARC_OFFSET) / 120, 1), ); goldNode.style.opacity = String( Math.min( Math.max(t - PULSE_START / 2, 0) / (PULSE_START / 2), 1, ), ); var pt = Math.max(t - PULSE_START, 0); if (pt > 0 && pt < PULSE_DUR) { goldNode.setAttribute( "r", 5.5 * (1 + 1.0 * Math.sin( (pt / PULSE_DUR) * Math.PI, )), ); } if (t < PULSE_START + PULSE_DUR) { requestAnimationFrame(tick); } else { tealArc.style.strokeDashoffset = "0"; emberMask.style.strokeDashoffset = "0"; tealDot.style.opacity = "1"; emberDot.style.opacity = "1"; goldNode.style.opacity = "1"; goldNode.setAttribute("r", "5.5"); }
```
--------------------------------
### Symbolic Seam Type Definitions
Source: https://github.com/georgebuilds/anneal/blob/main/SPEC.md
Defines the interface and concrete types for symbolic integers used in the seam. `ConstInt` represents a static integer value, while `SymInt` wraps a UOp for symbolic operations.
```go
type Sint interface { isSint(); ConstValue() (int64, bool) }
type ConstInt struct { V int64 }
type SymInt struct { Node uop.UOp }
```
--------------------------------
### Dark Mode Design Tokens
Source: https://github.com/georgebuilds/anneal/blob/main/docs/index.html
Defines CSS variables for dark mode, including background, surface, text, muted, faint colors, and brand colors.
```css
:root { /* Switchable surface tokens */ --bg: #14110f; --surface: #1f1a17; --text: #e8e2da; --muted: #8a817a; --faint: #5c544d; --bg-glass: rgba(20, 17, 15, 0.88); /* Brand colors — fixed; never invert */ --teal: #00add8; --ember: #ff7a45; --gold: #f2c57c; /* Text-safe variants: same as brand in dark mode (bright colors have enough contrast on dark bg), overridden to accessible darks in light mode. */ --teal-tx: #00add8; --ember-tx: #ff7a45; --gold-tx: #f2c57c; /* Terminal is always dark regardless of page theme */ --term-bg: #1f1a17; --term-border: #5c544d; --term-text: #e8e2da; --term-muted: #8a817a; --term-faint: #5c544d; --mono: "JetBrains Mono", ui-monospace, "SFMono-Regular", Menlo, Consolas, monospace; }
```
--------------------------------
### JavaScript Intersection Observer for Scroll Reveal
Source: https://github.com/georgebuilds/anneal/blob/main/docs/index.html
Uses IntersectionObserver to add a 'visible' class to sections as they enter the viewport, with a threshold of 8%. Falls back to adding 'visible' to all sections if IntersectionObserver is not supported.
```javascript
if ("IntersectionObserver" in window) { var io = new IntersectionObserver( function (entries) { entries.forEach(function (e) { if (e.isIntersecting) { e.target.classList.add("visible"); io.unobserve(e.target); } }); }, { threshold: 0.08 }, ); document.querySelectorAll("section").forEach(function (el) { io.observe(el); }); } else { document.querySelectorAll("section").forEach(function (el) { el.classList.add("visible"); }); }
```
--------------------------------
### nn.Parameter Value Field
Source: https://github.com/georgebuilds/anneal/blob/main/SPEC.md
The canonical weight vector for a parameter. This field lives on the Parameter struct and outlives any arena.
```go
type Parameter struct {
Value []float32
}
```
=== COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.