Skip to content

Staging#44

Merged
MankyDanky merged 2 commits intomainfrom
staging
Apr 17, 2026
Merged

Staging#44
MankyDanky merged 2 commits intomainfrom
staging

Conversation

@MankyDanky
Copy link
Copy Markdown
Collaborator

Fix for flash attention

MankyDanky and others added 2 commits April 16, 2026 21:38
Restructure tensor.ts to use _setNative() pattern with ES module live
bindings. Extract Node.js native addon loading into native-loader.ts.

Add complete web backend in src/web/ implementing all ~55 native API
methods in pure TypeScript:
- store.ts: TensorStore with Float32Array, shapes, strides, grad tracking
- tape.ts: tape-based autograd with backward dispatch and grad accumulation
- ops.ts: all forward+backward ops (elementwise, matmul, reductions,
  layout, activations, softmax, layerNorm, flashAttention, crossEntropy,
  embedding, dropout, conv1d/2d, pooling, tile, fused ops)
- optimizer.ts: AdamW step, gradient norm/clip, scale_grads, zero_grad
- native.ts: assembles all ops into native-compatible API object

Add index.web.ts as browser entry point using the pure TS backend.
Use conditional package.json exports (browser vs default) so bundlers
automatically select the web backend.

nn.ts, module.ts, and optimizer.ts remain completely unchanged.
feat: Add pure TypeScript backend for web
@MankyDanky MankyDanky merged commit 75d04d8 into main Apr 17, 2026
27 of 28 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant