@openfluke/welvet 0.74.0 → 0.75.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -1,6 +1,6 @@
1
1
  # @openfluke/welvet
2
2
 
3
- **M-POLY-VTD AI Engine (Loom v0.74.0)** — Isomorphic TypeScript/WASM library for building, training, and evolving neural networks with 21 numerical types, WebGPU acceleration, and DNA-based evolution.
3
+ **M-POLY-VTD AI Engine (Loom v0.75.0)** — Isomorphic TypeScript/WASM library for building, training, and evolving neural networks with 21 numerical types, WebGPU acceleration, and DNA-based evolution.
4
4
 
5
5
  [![npm version](https://img.shields.io/npm/v/@openfluke/welvet.svg)](https://www.npmjs.com/package/@openfluke/welvet)
6
6
  [![License](https://img.shields.io/badge/License-Apache%202.0-blue.svg)](https://opensource.org/licenses/Apache-2.0)
@@ -28,9 +28,9 @@ bun add @openfluke/welvet
28
28
  The engine initializes automatically after a single call to `init()`. It detects whether it's running in Node.js, Bun, or the Browser and loads the appropriate WASM environment.
29
29
 
30
30
  ```typescript
31
- import { init } from "@openfluke/welvet";
31
+ import welvet from "@openfluke/welvet";
32
32
 
33
- await init(); // Just works™
33
+ await welvet.init(); // Auto-detects Node.js/Browser and loads WASM
34
34
  ```
35
35
 
36
36
  > [!TIP]
@@ -39,18 +39,20 @@ await init(); // Just works™
39
39
  ### 2. Create a Network
40
40
 
41
41
  ```typescript
42
- import { createNetwork, DType } from "@openfluke/welvet";
42
+ import welvet from "@openfluke/welvet";
43
43
 
44
- const net = createNetwork({
44
+ // 1D sequential stack on the Volumetric Grid (cell 0,0,0)
45
+ const net = welvet.createNetwork({
46
+ depth: 1, rows: 1, cols: 1, layers_per_cell: 2,
45
47
  layers: [
46
- { type: "Dense", input_height: 784, output_height: 256, activation: "ReLU", dtype: DType.FLOAT32 },
47
- { type: "Dense", input_height: 256, output_height: 10, activation: "Linear", dtype: DType.FLOAT16 }
48
+ { z: 0, y: 0, x: 0, l: 0, type: "Dense", input_height: 784, output_height: 256, activation: "ReLU" },
49
+ { z: 0, y: 0, x: 0, l: 1, type: "Dense", input_height: 256, output_height: 10, activation: "Linear" }
48
50
  ]
49
51
  });
50
52
 
51
53
  const input = new Float32Array(784).fill(0.5);
52
54
  const output = net.sequentialForward(input);
53
- console.log("Prediction:", output);
55
+ console.log("Prediction:", output[0]); // Returns Float32Array
54
56
  ```
55
57
 
56
58
  ### 3. Training
@@ -66,17 +68,27 @@ const result = trainNetwork(net, batches, 10, 0.001);
66
68
  console.log("Final Loss:", result.final_loss);
67
69
  ```
68
70
 
69
- ### 4. NEAT Evolution
71
+ ### 4. Transformer (LLM Context)
70
72
 
71
73
  ```typescript
72
- import { createNEATPopulation } from "@openfluke/welvet";
74
+ // Create an MHA layer (Multi-Head Attention)
75
+ const tnet = welvet.createNetwork({
76
+ layers: [{ z: 0, y: 0, x: 0, l: 0, type: "MHA", d_model: 64, num_heads: 4 }]
77
+ });
78
+
79
+ // Wrap in Transformer context with pre-loaded weights
80
+ const model = welvet.createTransformer(tnet, embeds, lmHead, finalNorm);
81
+ const logits = model.forwardFull([1, 2, 3, 4]); // Direct token prefill
82
+ ```
73
83
 
74
- const population = createNEATPopulation(net, 100);
75
- const fitnesses = new Array(100).fill(0).map(() => Math.random());
84
+ ### 5. NEAT Evolution
85
+
86
+ ```typescript
87
+ const population = welvet.createNEATPopulation(net, 100);
88
+ const fitnesses = new Array(100).fill(1.0);
76
89
 
77
90
  population.evolveWithFitnesses(fitnesses);
78
- const bestNet = population.best();
79
- console.log("Best Fitness:", population.bestFitness());
91
+ console.log("Top Fitness:", population.bestFitness());
80
92
  ```
81
93
 
82
94
  ## Testing & Benchmarks
@@ -0,0 +1,298 @@
1
+ <!DOCTYPE html>
2
+ <html lang="en">
3
+ <head>
4
+ <meta charset="UTF-8">
5
+ <meta name="viewport" content="width=device-width, initial-scale=1.0">
6
+ <title>Loom WASM — 345-Item Parity Audit</title>
7
+ <style>
8
+ :root {
9
+ --bg: #050505;
10
+ --panel: #0f0f12;
11
+ --accent: #00d4ff;
12
+ --text: #e0e0e0;
13
+ --dim: #666;
14
+ --pass: #00ff9d;
15
+ --fail: #ff3e3e;
16
+ --warn: #ffcc00;
17
+ --indirect: #00d4ff;
18
+ }
19
+
20
+ * { box-sizing: border-box; margin: 0; padding: 0; }
21
+ body {
22
+ background: var(--bg);
23
+ color: var(--text);
24
+ font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
25
+ overflow-x: hidden;
26
+ line-height: 1.5;
27
+ }
28
+
29
+ .container { max-width: 1400px; margin: 0 auto; padding: 40px 20px; }
30
+
31
+ header {
32
+ border-bottom: 1px solid #222;
33
+ padding-bottom: 20px;
34
+ margin-bottom: 40px;
35
+ display: flex;
36
+ justify-content: space-between;
37
+ align-items: flex-end;
38
+ }
39
+
40
+ h1 {
41
+ font-size: 24px;
42
+ font-weight: 800;
43
+ letter-spacing: -1px;
44
+ color: var(--accent);
45
+ text-transform: uppercase;
46
+ }
47
+
48
+ .stats { display: flex; gap: 30px; }
49
+ .stat-card { text-align: right; }
50
+ .stat-val { font-size: 32px; font-weight: 900; color: #fff; }
51
+ .stat-label { font-size: 10px; color: var(--dim); text-transform: uppercase; letter-spacing: 1px; }
52
+
53
+ .controls { margin-bottom: 30px; display: flex; gap: 10px; }
54
+ button {
55
+ background: #1a1a1f;
56
+ border: 1px solid #333;
57
+ color: #fff;
58
+ padding: 10px 20px;
59
+ font-family: inherit;
60
+ font-weight: 600;
61
+ cursor: pointer;
62
+ transition: all 0.2s;
63
+ border-radius: 4px;
64
+ }
65
+ button:hover { background: #2a2a2f; border-color: var(--accent); color: var(--accent); }
66
+ button:disabled { opacity: 0.3; cursor: not-allowed; }
67
+
68
+ .grid {
69
+ display: grid;
70
+ grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
71
+ gap: 20px;
72
+ }
73
+
74
+ .category-card {
75
+ background: var(--panel);
76
+ border: 1px solid #1a1a1f;
77
+ border-radius: 8px;
78
+ padding: 20px;
79
+ display: flex;
80
+ flex-direction: column;
81
+ }
82
+
83
+ .category-title {
84
+ font-size: 14px;
85
+ font-weight: 800;
86
+ margin-bottom: 15px;
87
+ color: var(--dim);
88
+ border-bottom: 1px solid #222;
89
+ padding-bottom: 10px;
90
+ display: flex;
91
+ justify-content: space-between;
92
+ }
93
+
94
+ .item-list {
95
+ font-family: 'JetBrains Mono', 'Courier New', monospace;
96
+ font-size: 11px;
97
+ display: flex;
98
+ flex-direction: column;
99
+ gap: 4px;
100
+ }
101
+
102
+ .item {
103
+ display: flex;
104
+ justify-content: space-between;
105
+ padding: 4px 8px;
106
+ border-radius: 3px;
107
+ background: rgba(255,255,255,0.02);
108
+ }
109
+
110
+ .status-tag {
111
+ font-weight: 700;
112
+ font-size: 9px;
113
+ padding: 2px 6px;
114
+ border-radius: 10px;
115
+ text-transform: uppercase;
116
+ }
117
+
118
+ .PASS { color: var(--pass); background: rgba(0, 255, 157, 0.1); }
119
+ .FAIL { color: var(--fail); background: rgba(255, 62, 62, 0.1); }
120
+ .MISSING { color: var(--dim); background: rgba(255, 255, 255, 0.05); }
121
+ .INDIRECT { color: var(--indirect); background: rgba(0, 212, 255, 0.1); }
122
+
123
+ #terminal {
124
+ margin-top: 40px;
125
+ background: #000;
126
+ border: 1px solid #333;
127
+ border-radius: 4px;
128
+ padding: 15px;
129
+ font-family: 'JetBrains Mono', monospace;
130
+ font-size: 12px;
131
+ color: #888;
132
+ height: 200px;
133
+ overflow-y: auto;
134
+ white-space: pre-wrap;
135
+ }
136
+
137
+ ::-webkit-scrollbar { width: 6px; }
138
+ ::-webkit-scrollbar-track { background: transparent; }
139
+ ::-webkit-scrollbar-thumb { background: #333; border-radius: 10px; }
140
+
141
+ .glow {
142
+ text-shadow: 0 0 10px var(--accent);
143
+ }
144
+ </style>
145
+ </head>
146
+ <body>
147
+ <div class="container">
148
+ <header>
149
+ <div>
150
+ <h1>Loom Engine — WASM Binary Audit</h1>
151
+ <p class="subtitle" style="font-size: 11px; color: var(--dim); margin-top: 5px;">M-POLY-VTD-0.75-STABLE | Parity Verification Suite</p>
152
+ </div>
153
+ <div class="stats">
154
+ <div class="stat-card">
155
+ <div class="stat-val" id="totalPass">0</div>
156
+ <div class="stat-label">Functions Live</div>
157
+ </div>
158
+ <div class="stat-card">
159
+ <div class="stat-val" id="coverageVal">0%</div>
160
+ <div class="stat-label">Global Coverage</div>
161
+ </div>
162
+ </div>
163
+ </header>
164
+
165
+ <div class="controls">
166
+ <button id="auditBtn" onclick="startAudit()">Initialize Engine Parity Engine</button>
167
+ <button onclick="clearLogs()" style="border: none; color: var(--dim);">Clear Logs</button>
168
+ </div>
169
+
170
+ <div id="grid" class="grid">
171
+ <!-- Dynamic Category Cards -->
172
+ </div>
173
+
174
+ <div id="terminal">Initializing Audit System... Ready for induction.</div>
175
+ </div>
176
+
177
+ <script src="wasm_exec.js"></script>
178
+ <script src="check.js"></script>
179
+ <script>
180
+ let wasmReady = false;
181
+ let expectedApi = null;
182
+
183
+ function log(msg, color = "#888") {
184
+ const t = document.getElementById('terminal');
185
+ const line = document.createElement('div');
186
+ line.style.color = color;
187
+ line.textContent = `[${new Date().toLocaleTimeString()}] ${msg}`;
188
+ t.appendChild(line);
189
+ t.scrollTop = t.scrollHeight;
190
+ }
191
+
192
+ async function init() {
193
+ try {
194
+ log("Fetching expected_api.json...");
195
+ const res = await fetch('./expected_api.json');
196
+ if (!res.ok) throw new Error(`HTTP error! status: ${res.status}`);
197
+ expectedApi = await res.json();
198
+ log("Blueprint loaded. 345 core items mapped.");
199
+
200
+ renderSkeleton();
201
+ } catch (e) {
202
+ log("Initialization Error: " + e.message, "#ff3e3e");
203
+ }
204
+ }
205
+
206
+ function renderSkeleton() {
207
+ const grid = document.getElementById('grid');
208
+ grid.innerHTML = '';
209
+ for (const [cat, items] of Object.entries(expectedApi)) {
210
+ const card = document.createElement('div');
211
+ card.className = 'category-card';
212
+ card.id = `cat-${cat}`;
213
+ card.innerHTML = `
214
+ <div class="category-title">
215
+ <span>${cat}</span>
216
+ <span id="score-${cat}" style="color: var(--accent);">0/${items.length}</span>
217
+ </div>
218
+ <div class="item-list" id="list-${cat}">
219
+ ${items.map(i => `
220
+ <div class="item" id="item-${i.name}">
221
+ <span>${i.name}</span>
222
+ <span class="status-tag MISSING">PENDING</span>
223
+ </div>
224
+ `).join('')}
225
+ </div>
226
+ `;
227
+ grid.appendChild(card);
228
+ }
229
+ }
230
+
231
+ async function loadWASM() {
232
+ if (wasmReady) return;
233
+ log("Loading main.wasm binary...");
234
+ const go = new Go();
235
+ try {
236
+ const result = await WebAssembly.instantiateStreaming(fetch('main.wasm'), go.importObject);
237
+ go.run(result.instance);
238
+ await new Promise(r => setTimeout(r, 200));
239
+ wasmReady = true;
240
+ log("WASM Runtime Active. Signal acquired.", "#00ff9d");
241
+ } catch (e) {
242
+ log("Binary Load Failure: " + e.message, "#ff3e3e");
243
+ }
244
+ }
245
+
246
+ async function startAudit() {
247
+ document.getElementById('auditBtn').disabled = true;
248
+ await loadWASM();
249
+ if (!wasmReady) return;
250
+
251
+ log("Starting multi-stage parity induction...");
252
+ const results = await window.runParityAudit(null, expectedApi);
253
+
254
+ let totalPass = 0;
255
+ let totalCount = 0;
256
+ const catScores = {};
257
+
258
+ for (const res of results) {
259
+ totalCount++;
260
+ if (res.status === 'PASS' || res.status === 'INDIRECT') totalPass++;
261
+
262
+ if (!catScores[res.category]) catScores[res.category] = { pass: 0, total: 0 };
263
+ catScores[res.category].total++;
264
+ if (res.status === 'PASS' || res.status === 'INDIRECT') catScores[res.category].pass++;
265
+
266
+ const el = document.getElementById(`item-${res.name}`);
267
+ if (el) {
268
+ const tag = el.querySelector('.status-tag');
269
+ tag.className = `status-tag ${res.status}`;
270
+ tag.textContent = res.status;
271
+ }
272
+ }
273
+
274
+ // Update scores
275
+ for (const [cat, score] of Object.entries(catScores)) {
276
+ document.getElementById(`score-${cat}`).textContent = `${score.pass}/${score.total}`;
277
+ }
278
+
279
+ document.getElementById('totalPass').textContent = totalPass;
280
+ const coverage = ((totalPass / totalCount) * 100).toFixed(1);
281
+ document.getElementById('coverageVal').textContent = `${coverage}%`;
282
+
283
+ if (parseFloat(coverage) >= 90) {
284
+ document.getElementById('coverageVal').className = 'stat-val glow';
285
+ }
286
+
287
+ log(`Audit Complete. Coverage: ${coverage}% | Checks: ${totalCount}`, "#00ff9d");
288
+ document.getElementById('auditBtn').disabled = false;
289
+ }
290
+
291
+ function clearLogs() {
292
+ document.getElementById('terminal').innerHTML = '';
293
+ }
294
+
295
+ window.onload = init;
296
+ </script>
297
+ </body>
298
+ </html>
@@ -0,0 +1,283 @@
1
+ <!DOCTYPE html>
2
+ <html lang="en">
3
+
4
+ <head>
5
+ <meta charset="UTF-8">
6
+ <meta name="viewport" content="width=device-width, initial-scale=1.0">
7
+ <title>Loom Core | Browser AI Engine</title>
8
+ <style>
9
+ :root {
10
+ --bg: #0a0a0c;
11
+ --panel: rgba(255, 255, 255, 0.03);
12
+ --accent: #00f2ff;
13
+ --accent-glow: rgba(0, 242, 255, 0.3);
14
+ --text: #e0e0e6;
15
+ --dim: #888891;
16
+ --border: rgba(255, 255, 255, 0.1);
17
+ }
18
+
19
+ body {
20
+ background-color: var(--bg);
21
+ color: var(--text);
22
+ font-family: 'Inter', -apple-system, system-ui, sans-serif;
23
+ margin: 0;
24
+ display: flex;
25
+ height: 100vh;
26
+ overflow: hidden;
27
+ }
28
+
29
+ /* Sidebar Navigation */
30
+ nav {
31
+ width: 280px;
32
+ border-right: 1px solid var(--border);
33
+ padding: 40px 20px;
34
+ display: flex;
35
+ flex-direction: column;
36
+ gap: 12px;
37
+ }
38
+
39
+ .logo {
40
+ font-size: 20px;
41
+ font-weight: 800;
42
+ letter-spacing: -1px;
43
+ color: var(--accent);
44
+ margin-bottom: 40px;
45
+ display: flex;
46
+ align-items: center;
47
+ gap: 10px;
48
+ }
49
+
50
+ .nav-btn {
51
+ padding: 12px 16px;
52
+ border-radius: 8px;
53
+ cursor: pointer;
54
+ transition: 0.2s;
55
+ font-size: 14px;
56
+ color: var(--dim);
57
+ border: 1px solid transparent;
58
+ }
59
+
60
+ .nav-btn:hover {
61
+ background: var(--panel);
62
+ color: white;
63
+ }
64
+
65
+ .nav-btn.active {
66
+ background: var(--accent-glow);
67
+ color: var(--accent);
68
+ border-color: var(--border);
69
+ }
70
+
71
+ /* Main Content Area */
72
+ main {
73
+ flex: 1;
74
+ padding: 40px;
75
+ overflow-y: auto;
76
+ position: relative;
77
+ }
78
+
79
+ .card {
80
+ background: var(--panel);
81
+ border: 1px solid var(--border);
82
+ border-radius: 12px;
83
+ padding: 24px;
84
+ margin-bottom: 24px;
85
+ backdrop-filter: blur(10px);
86
+ }
87
+
88
+ h2 {
89
+ font-size: 18px;
90
+ margin-top: 0;
91
+ color: white;
92
+ }
93
+
94
+ p {
95
+ font-size: 14px;
96
+ color: var(--dim);
97
+ line-height: 1.6;
98
+ }
99
+
100
+ .status-badge {
101
+ display: inline-flex;
102
+ align-items: center;
103
+ gap: 6px;
104
+ padding: 4px 10px;
105
+ border-radius: 100px;
106
+ font-size: 11px;
107
+ text-transform: uppercase;
108
+ font-weight: 700;
109
+ background: rgba(255, 255, 255, 0.05);
110
+ }
111
+
112
+ .status-badge.ready {
113
+ color: #00ff88;
114
+ background: rgba(0, 255, 136, 0.1);
115
+ }
116
+
117
+ .terminal {
118
+ background: #000;
119
+ border-radius: 8px;
120
+ padding: 16px;
121
+ font-family: 'JetBrains Mono', monospace;
122
+ font-size: 12px;
123
+ color: #00ff88;
124
+ height: 200px;
125
+ overflow-y: auto;
126
+ border: 1px solid #111;
127
+ }
128
+
129
+ button.primary {
130
+ background: var(--accent);
131
+ color: black;
132
+ border: none;
133
+ padding: 12px 24px;
134
+ border-radius: 6px;
135
+ font-weight: 600;
136
+ cursor: pointer;
137
+ transition: 0.2s;
138
+ }
139
+
140
+ button.primary:hover {
141
+ box-shadow: 0 0 20px var(--accent-glow);
142
+ transform: translateY(-1px);
143
+ }
144
+
145
+ .grid {
146
+ display: grid;
147
+ grid-template-columns: repeat(2, 1fr);
148
+ gap: 20px;
149
+ }
150
+ </style>
151
+ </head>
152
+
153
+ <body>
154
+
155
+ <nav>
156
+ <div class="logo">
157
+ <svg width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="3">
158
+ <path d="M12 2L2 7l10 5 10-5-10-5zM2 17l10 5 10-5M2 12l10 5 10-5" />
159
+ </svg>
160
+ LOOM CORE
161
+ </div>
162
+ <div class="nav-btn active">Dashboard</div>
163
+ <div class="nav-btn">Engine Audit</div>
164
+ <div class="nav-btn">DNA Lab</div>
165
+ <div class="nav-btn">Weights Management</div>
166
+ </nav>
167
+
168
+ <main>
169
+ <div style="display: flex; justify-content: space-between; align-items: center; margin-bottom: 32px;">
170
+ <div>
171
+ <h1 style="margin:0; font-size: 24px;">System Overview</h1>
172
+ <div class="status-badge ready" id="hw-status">Initializing...</div>
173
+ </div>
174
+ <button class="primary" onclick="runDemo()">Execute Full Forward Pass</button>
175
+ </div>
176
+
177
+ <div class="grid">
178
+ <div class="card">
179
+ <h2>Network Intelligence</h2>
180
+ <p>Constructing polymorphic networks directly from JSON definitions with strict DType enforcement.</p>
181
+ <div class="terminal" id="net-log">Waiting for engine...</div>
182
+ </div>
183
+ <div class="card">
184
+ <h2>Transformer Prefill</h2>
185
+ <p>Simulating 4096-seq/768-dim Transformer prefill using WebGPU resident context.</p>
186
+ <div class="terminal" id="gpu-log">GPU Idle</div>
187
+ </div>
188
+ </div>
189
+
190
+ <div class="card">
191
+ <h2>DNA Comparison (Crossover Analytics)</h2>
192
+ <div id="dna-chart" style="height: 100px; display: flex; align-items: flex-end; gap: 4px;">
193
+ <!-- Bars will go here -->
194
+ </div>
195
+ <p style="margin-top: 15px;">Genetic distance between Network Alpha and Network Beta: <span id="dna-dist"
196
+ style="color:var(--accent)">0.00%</span></p>
197
+ </div>
198
+ </main>
199
+
200
+ <script src="wasm_exec.js"></script>
201
+ <script>
202
+ const go = new Go();
203
+ let engine;
204
+
205
+ // 1. Loading and Initializing the Engine
206
+ WebAssembly.instantiateStreaming(fetch("main.wasm"), go.importObject).then(async (result) => {
207
+ go.run(result.instance);
208
+
209
+ log("net-log", "LOOM v0.75-STABLE WASM Runtime Loaded.");
210
+
211
+ // Setup WebGPU
212
+ try {
213
+ const status = await window.setupWebGPU();
214
+ document.getElementById('hw-status').innerText = "WGPU ACCELERATION: ACTIVE";
215
+ log("gpu-log", "WebGPU Context initialized successfully.");
216
+ } catch (e) {
217
+ document.getElementById('hw-status').style.color = "#ff4444";
218
+ document.getElementById('hw-status').innerText = "WGPU ERROR: CPU FALLBACK";
219
+ }
220
+
221
+ initDemo();
222
+ });
223
+
224
+ function log(id, msg) {
225
+ const el = document.getElementById(id);
226
+ const time = new Date().toLocaleTimeString();
227
+ el.innerHTML += `<div><span style="color:#555">[${time}]</span> ${msg}</div>`;
228
+ el.scrollTop = el.scrollHeight;
229
+ }
230
+
231
+ async function initDemo() {
232
+ // Build a Network from JSON (Strict Functional Parity Check)
233
+ const config = {
234
+ depth: 1, rows: 1, cols: 1, layers_per_cell: 4,
235
+ layers: [
236
+ { type: "Embedding", input_height: 32000, output_height: 768 },
237
+ { type: "RMSNorm", input_height: 768 },
238
+ { type: "MultiHeadAttention", d_model: 768, num_heads: 12, seq_length: 512 },
239
+ { type: "Dense", input_height: 768, output_height: 32000, activation: "Softmax" }
240
+ ]
241
+ };
242
+
243
+ const net = window.BuildNetworkFromJSON(JSON.stringify(config));
244
+ log("net-log", "Network Alpha built successfully.");
245
+
246
+ // Extract DNA and compare
247
+ const dnaA = window.ExtractDNA(net._id);
248
+ const netAlt = window.BuildNetworkFromJSON(JSON.stringify(config));
249
+ const dnaB = window.ExtractDNA(netAlt._id);
250
+
251
+ const comparisonJSON = window.compareLoomDNA(dnaA, dnaB);
252
+ const comparison = JSON.parse(comparisonJSON);
253
+ const score = (comparison.OverallOverlap || 0) * 100;
254
+
255
+ document.getElementById('dna-dist').innerText = score.toFixed(2) + "%";
256
+ log("net-log", `DNA Hash Alpha: ${dnaA.substring(0, 32)}...`);
257
+ }
258
+
259
+ function runDemo() {
260
+ log("gpu-log", "Beginning Full Pass on WGPU context...");
261
+
262
+ requestAnimationFrame(() => {
263
+ setTimeout(() => {
264
+ const input = new Float32Array(768).map(() => Math.random());
265
+
266
+ const config = JSON.stringify({
267
+ layers: [{ type: "Dense", input_height: 768, output_height: 768, activation: "ReLU" }]
268
+ });
269
+ const net = window.BuildNetworkFromJSON(config);
270
+
271
+ const start = performance.now();
272
+ const result = net.sequentialForward(input);
273
+ const end = performance.now();
274
+
275
+ log("gpu-log", `Inference complete in ${(end - start).toFixed(2)}ms.`);
276
+ log("gpu-log", `Result Shape: [1, ${result.data.length}]`);
277
+ }, 100);
278
+ });
279
+ }
280
+ </script>
281
+ </body>
282
+
283
+ </html>