Frequently Asked Questions

Does TensorFlow.js support Node.js?

Yes! We recently released node.js bindings for TensorFlow. This allows the same JavaScript code to work on both the browser and node.js, while binding to the underlying TensorFlow C implementation in node. You can follow it's development on GitHub or try out our NPM package

Can I import a TensorFlow or Keras model into the browser?

Yes! We have two tutorials for importing TensorFlow models. One for the TensorFlow SavedModel format, and one for importing Keras HDF5 models.

Can I export my model from the browser?

Since Version 0.11.1, you can export the topology and weights of tf.Models to, or load them back from, browser Local Storage and IndexedDB. You can also trigger downloading of tf.Models as files or load tf.Models from user-selected files in the browser. In addition, tf.Models can be sent to HTTP servers through multipart/form-data requests. See the tutorial page for more details.

We are currently working on these additional features for model import/export:

How does this relate to TensorFlow?

TensorFlow.js has an API similar to the TensorFlow Python API, however it does not support all of the functionality of the TensorFlow Python API. We are working hard to achieve API parity where it makes sense but also strive to provide an idiomatic JS API.

How does TensorFlow.js performance compare to the Python version?

In our experience, for inference, TensorFlow.js with WebGL is 1.5-2x slower than TensorFlow Python with AVX. For training, we have seen small models train faster in the browser and large models train up to 10-15x slower in the browser, compared to TensorFlow Python with AVX.

Please take a look at this benchmark to get more detailed performance measurements.

What is the difference between TensorFlow.js and deeplearn.js?

TensorFlow.js is an ecosystem of JavaScript tools for machine learning that evolved from deeplearn.js. deeplearn.js is now called TensorFlow.js Core. TensorFlow.js also includes a Layers API—a higher level library for building machine learning models—as well as tools for automatically porting TensorFlow SavedModels and Keras HDF5 models.

I still have some questions

Please feel free to look at our issues tracker and file a bug there. We also have a community mailing list for people to ask questions, get technical help, and share what they are doing with TensorFlow.js! To keep up to date with TensorFlow.js news follow us on twitter or join the announcement only mailing list.