Tensorflow.js

Tensorflow.js (tfjs) is a WebGL accelerated library for performing ML/Deep Learning tasks in-browser. It evolved out of the deeplearn.js library, which is now called Tensorflow.js Core.

With tfjs, you can run the same code using multiple backends:

The WebGL backend can be expected to run at 1.5-2x slower than Python Tensorflow. With larger models it has been found to run 10-15x slower. That said, it is amazing that Tensorflow.js brings graphics accelerated machine learning to the web! What you may lose in speed, you gain in potential reach and deployability. Users of a product written in Tensorflow.js need only a modern web browser, while native ML libraries that leverage CUDA require special NVIDIA graphics hardware and drivers. There is little-to-no barrier to entry with Tensorflow.js.

Tensorflow.js tries to provide an API that is as close to Python Tensorflow as possible, but does not include all of the functions present in Python. The Layers API (tf.layers) is a high-level API for creating neural networks inspired by Keras.

Electron

With Electron, you can also build desktop applications using Tensorflow.js that also benefit from zero hardware, library, or driver dependence. We've bundled several tfjs examples as an Electron app in our brangerbriz/tf-electron repository. Here is an introductory Electron tutorial as well.

Return to the main page.

All source code in this document is licensed under the GPL v3 or any later version. All non-source code text is licensed under a CC-BY-SA 4.0 international license. You are free to copy, remix, build upon, and distribute this work in any format for any purpose under those terms. A copy of this website is available on GitHub.