Custom build of Tensorflow/JS for Browsers as pure ESNext
MIT License
This solution builds TensorFlow/JS for Browsers, including individual modules as well as a unified bundle
Included Backends: CPU
, WebGL
, WebGPU
, WASM
Node packages (tfjs-node
and tfjs-node-gpu
) are not covered
tfjs
sourcestf.es2017.js
is 3.9MB without wasm
and webgpu
backends which are another 2MB on toptfjs.esm.js
is 2.5MB with wasm
and webgpu
includednpm install
bazel 4.x
https://docs.bazel.build/versions/4.2.1/install-ubuntu.htmlpython 3.x
aliased as python
, not compatible with python 2.x
npm run build
executes steps:
scripts/download.sh
@tensorflow/tfjs
from git into ./src
@tensorflow/tfjs
scripts/prepare.sh
.tfjs-*.ts
from build templates.js
imports from .json
filesscripts/wasm.sh
.js
exports using bazel
node scripts/bundle.js
/dist
using esbuild
with custom resolver plugins and TypeScript compiler settingsscripts/types.sh
/lib
using tsc
& api-extractor
To remove currently downloaded version of TFJS and reset all cached info
npm run clean