Back to browse
GitHub Repository

NumPy for the browser GPU — zero shaders, zero dependencies

5 starsTypeScript

Accel-GPU – NumPy for the browser GPU

by Phantasm0009·Mar 2, 2026·2 points·0 comments

AI Analysis

●●●BangerWizardryShip ItZero to One

NumPy API on WebGPU with zero shader writing beats TensorFlow.js bloat for compute.

Strengths
  • Shader abstraction is genius—pre-built WGSL kernels eliminate boilerplate without sacrificing control
  • Universal fallback (WebGPU→WebGL2→CPU) with identical API is rare and properly executed; runs anywhere
Weaknesses
  • Lacks conv2d/pooling on GPU (CPU-only); real ML models need efficient convolution
  • 160KB minified is still heavy for basic arrays; compare TensorFlow.js reach vs this niche
Target Audience

Web developers doing numerical computing, ML inference, or data processing in browsers

Similar To

TensorFlow.js · GPU.js · NumJS

Post Description

I built a small WebGPU library that gives you a NumPy-like API in the browser—arrays, matmul, softmax, that kind of thing. No shaders to write, no TensorFlow.js. Just `gpu.array([1,2,3])` and `await a.add(b)`.

It falls back to WebGL2 when WebGPU isn't available (Safari, Firefox) and to CPU for Node/headless. Same API everywhere. ~160KB minified, zero dependencies.

The shaders are pre-built WGSL—add, mul, relu, layer norm, attention scores, etc. I added FFT and spectrogram recently, plus conv2d and pooling (CPU for now). Reductions like sum/max use multi-pass since you can't fit 1M elements in one workgroup.

Demos: [phantasm0009.github.io/accel-gpu](https://phantasm0009.github.io/accel-gpu/) — basic math, image processing, heatmap, neural net inference, N-body sim. Would love feedback.

GitHub: [github.com/Phantasm0009/accel-gpu](https://github.com/Phantasm0009/accel-gpu)

Similar Projects