TensorFlow.js now has a WebAssembly backend

Faster machine learning in the browser: TensorFlow.js combines ML and JavaScript, and now the open source library works with a brand-new WebAssembly backend! It offers an alternative to the WebGL backend to provide benefits in certain use cases. Let’s take a closer look!
TensorFlow.js was developed by Google to let JavaScript developers dive into machine learning—and they don’t even need an advanced math degree to do so.
SEE ALSO: Web developers don’t need a math degree to get started with machine learning
The latest update to the open source machine learning library is a WebAssembly backend that was announced in a blog post. Let’s see what it can do!
The WebAssembly backend
WebAssembly (Wasm) is “a binary instruction format for a stack-based virtual machine” to serve as a portable target for compiling high-level languages on the web. It runs cross-browser and outside the browser.
The Wasm backend for TensorFlow.js offers support for the browser and Node.js and is designed to boost performance on lower-end mobile devices. After all, Wasm allows native decoding that is up to 20x faster than JavaScript can be parsed.
But be careful: In most cases, the previous WebGL backend will still outperform the Wasm backend. It can only be faster for ultra-lite models such as FaceMesh, which is designed “to infer the approximate surface geometry of a human face” and runs on WebAssembly:
As the WebGL backend is still in use as well, TensorFlow.js will define a priority for each backend and automatically choose which one to use in a specific environment. The TensorFlow team believes the Wasm backend will become increasingly popular as ultra-light models for edge devices are on the rise.
SEE ALSO: Introduction to machine learning in Node.js
You can install the WebAssembly backend either via npm or with script tags.
Head over to the TensorFlow Blog for further details.