webmachinelearning / webnn-polyfill

🧠⚙️ Web Neural Network API polyfill based on TensorFlow.js
https://www.npmjs.com/package/@webmachinelearning/webnn-polyfill
Apache License 2.0
102 stars 18 forks source link

Tests don't work with wasm backend #91

Closed huningxin closed 3 years ago

huningxin commented 3 years ago

Try https://webmachinelearning.github.io/webnn-polyfill/test/?backend=wasm

The error message in console is

worker.js onmessage() captured an uncaught exception: ReferenceError: o is not defined

@Honry , could you please take a look?

Honry commented 3 years ago

@huningxin, sure, I can reproduce this on latest Chrome Stable 91.0.4472.164, but not reproduce on latest Chrome Canary 94.0.4579.0, I will try with a simple test to see if this is upstream issue.

Honry commented 3 years ago

I found that build polyfill with npm run build will not reproduce this issue, while with npm run build-production reproduces. I will look into the webpack.

Honry commented 3 years ago

build-production will minimize the js code, and this is a known issue when pack wasm backend with minification. see https://github.com/tensorflow/tfjs/blob/master/tfjs-backend-wasm/README.md#js-minification, I will add this workaround to fix the issue.