wasm backend returns incorrect values as result
See original GitHub issueI have a very simple float32 model (link provided in the code below) that takes image with values in range of 0…255 as input and returns a single float32 value.
Works perfectly with webgl
backend, but values explode using wasm
backend.
E.g., instead of returning value in range of 1-99, it returns values like 700+.
This is just one more case that looks like incorrect cast inside wasm
backend, likely related to #4326 and #4311 that I’ve reported earlier.
simple reproduction code:
const resizeT = tf.image.resizeBilinear(image, [64, 64], false); // image is any picture of a face
const normalizeT = tf.mul(resizeT, [255.0]);
resizeT.dispose();
const model = await tf.loadGraphModel('https://vladmandic.github.io/human/models/age-ssrnet-imdb.json');
const ageT = await model.predict(normalizeT);
normalizeT.dispose();
const age = ageT.dataSync();
ageT.dispose();
console.log(age);
Environment: TFJS 2.8.3 on Chrome 87 / Windows 10
Issue Analytics
- State:
- Created 3 years ago
- Reactions:1
- Comments:7 (3 by maintainers)
Top Results From Across the Web
wasm backend is unusable for model training #4326
upgraded to tfjs 3.2.0 and confirmed as resolved - wasm backend now returns same results as webgl backend when used for model training....
Read more >Wasm module exceeding maximum allowed functions
I changed the return values on create() and update() to include two function returns, and maybe that is what's causing it. No idea...
Read more >Multi-Value All The Wasm!
Multi-value is a proposed extension to core WebAssembly that enables functions to return many values, among other things.
Read more >Platform and environment | TensorFlow.js
WASM backend leverages the XNNPACK library for optimized implementation of neural network operators. Versus JavaScript: WASM binaries are ...
Read more >Rasm: Compiling Racket to WebAssembly
Scheme compiler that is the backend of Racket. ... functions to convert returned WebAssembly values to their JavaScript ... incorrect parameter types.
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
(sorry, I was on vacation last week)
Today we figured out that the error was caused by out-of-date xnnpack+emscripten. I am in the process of updating our toolchain to the latest xnnpack and emscripten. Hopefully it can be done this week. Thanks!
BTW we further noticed that the wrong results come from some of the “div” nodes. With SIMD enabled, those nodes produce the results with the numerator and the denominator swapped… I am asking folks from the xnnpack project to investigate further. Thanks!