
Security News
Deno 2.2 Improves Dependency Management and Expands Node.js Compatibility
Deno 2.2 enhances Node.js compatibility, improves dependency management, adds OpenTelemetry support, and expands linting and task automation for developers.
@tensorflow/tfjs-node
Advanced tools
**This repo is under active development and is not production-ready. We are actively developing as an open source project.**
This repo is under active development and is not production-ready. We are actively developing as an open source project.
TensorFlow.js for Node currently supports the following platforms:
Other Linux variants might also work but this project matches core TensorFlow installation requirements.
npm install @tensorflow/tfjs-node
(or)
yarn add @tensorflow/tfjs-node
npm install @tensorflow/tfjs-node-gpu
(or)
yarn add @tensorflow/tfjs-node-gpu
Before executing any TensorFlow.js code, load and set the backend to 'tensorflow'.
import * as tf from '@tensorflow/tfjs';
// Load the binding
import '@tensorflow/tfjs-node';
// Or if running with GPU:
import '@tensorflow/tfjs-node-gpu';
tf.setBackend('tensorflow');
# Download and install JS dependencies, including libtensorflow 1.8.
yarn
# Run TFJS tests against Node.js backend:
yarn test
# Switch to GPU for local development:
yarn enable-gpu
See the demo
directory that trains MNIST using TensorFlow.js with the
TensorFlow C backend.
cd demo/
yarn
# Run the training script. See demo/package.json for this script.
yarn mnist
The important line to note is at the top of mnist.ts
, which sets the backend to
TensorFlow.
This requires installing bazel first.
bazel build --config=monolithic //tensorflow/tools/lib_package:libtensorflow
FAQs
This repository provides native TensorFlow execution in backend JavaScript applications under the Node.js runtime, accelerated by the TensorFlow C binary under the hood. It provides the same API as [TensorFlow.js](https://js.tensorflow.org/api/latest/).
The npm package @tensorflow/tfjs-node receives a total of 55,981 weekly downloads. As such, @tensorflow/tfjs-node popularity was classified as popular.
We found that @tensorflow/tfjs-node demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 10 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Deno 2.2 enhances Node.js compatibility, improves dependency management, adds OpenTelemetry support, and expands linting and task automation for developers.
Security News
React's CRA deprecation announcement sparked community criticism over framework recommendations, leading to quick updates acknowledging build tools like Vite as valid alternatives.
Security News
Ransomware payment rates hit an all-time low in 2024 as law enforcement crackdowns, stronger defenses, and shifting policies make attacks riskier and less profitable.