Practical overview
When it fits
Use TensorFlow.js when the model workflow needs to live in JavaScript, particularly in a browser or Node.js application, or when an existing TensorFlow model needs a browser-oriented execution path.
Who it is for
- JavaScript and TypeScript developers building machine-learning features for web applications
- Teams creating Node.js services that use the TensorFlow.js API
- Developers adapting existing TensorFlow models for browser execution
- Experimenters training models with browser data or supported hardware-accelerated backends
Documented uses
- Build and train machine-learning models with low-level or high-level JavaScript APIs
- Load and prepare data for model workflows
- Convert existing TensorFlow models for use in TensorFlow.js
- Run inference from existing models in the browser
- Retrain models using sensor data or other client-side data
Requirements & limits
The project is publicly accessible and open source under the Apache-2.0 licence. The documented entry points are a browser script tag or installation through NPM or Yarn.
- Browser execution can use CPU, WebGL, WebAssembly or WebGPU backends exposed by the project.
- Node.js support is provided through a TensorFlow C++ adapter rather than the browser backends.
- The package set is modular, allowing individual packages to be imported when bundle size matters.
- The NPM workflow uses ES2017 syntax and requires a modern browser or a bundler/transpiler.
- The model converter is relevant when the starting point is an existing TensorFlow SavedModel.
Check current requirements in the official documentation. Source-based guidance does not mean OpenViST has run or independently tested this project.
Add TensorFlow.js to a browser page and train a small model
Set up TensorFlow.js in an HTML file and follow the documented linear-regression training flow.
Before you start
- An HTML file
- A browser
- The TensorFlow.js distribution loaded with the documented jsDelivr script tag
Steps
Add the TensorFlow.js script tag to the HTML file.
Create a sequential model with a dense layer for one-dimensional input.
Compile the model with mean squared error loss and the stochastic-gradient-descent optimizer.
Create the documented tensor data, train the model with model.fit, and call model.predict after training.
Expected outcome
A browser page contains a TensorFlow.js model that trains on the example data and prints a prediction in the browser developer tools.
Guide limitations
- This recipe covers the documented browser example only; it does not establish performance or compatibility across browsers or devices.
Add TensorFlow.js to a JavaScript project with NPM or Yarn
Prepare a JavaScript project to use TensorFlow.js through a package manager and a build workflow.
Before you start
- A JavaScript project
- NPM or Yarn
- A modern browser or a bundler/transpiler that can handle ES2017 syntax
- A build tool such as Parcel, Webpack or Rollup
Steps
Add TensorFlow.js to the project with NPM or Yarn.
Import TensorFlow.js in the project with the documented JavaScript module syntax.
Use a build tool or bundler workflow to process the project.
Continue with the documented model-definition, compilation, training and prediction example.
Expected outcome
The project is set up to use TensorFlow.js through its JavaScript module API.
Guide limitations
- The cited getting-started material documents setup and an example flow but does not provide a complete project configuration for every build tool.
Compare options for Model inference and serving
These projects document a common task and share a project role. This is a source-based comparison, not an execution benchmark or a guarantee of interchangeability.
| Project | Documented purpose | Platform | Access and requirements |
|---|---|---|---|
| TensorFlow.js | Build and train machine-learning models with low-level or high-level JavaScript APIs | Server, Web | The project is publicly accessible and open source under the Apache-2.0 licence. The documented entry points are a browser script tag or installation through NPM or Yarn. |
| Hyperpose | Customize pose-estimation architectures and datasets. | Docker, Linux, macOS, Windows | |
| Multi Task Nlp | Define multiple tasks and their data and model settings in a YAML file. | Linux, macOS, Windows | The project is an open-source library under the Apache-2.0 license, distributed through its public GitHub repository. |
Sources & review
Source record details
- Source availability
- Active
- Sources checked
- 2 October 2026
- Original website title
- tensorflow/tfjs · Official homepage title · retained in its source language

