TensorFlow.js now has a WebAssembly backend
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.
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.
You can install the WebAssembly backend either via npm or with script tags.
Head over to the TensorFlow Blog for further details.