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

Support wasm backend #89

Closed Honry closed 3 years ago

Honry commented 3 years ago

Delivers wasm binaries to dist/ foloder for wasm backend.

Honry commented 3 years ago

@BruceDai, @huningxin, PTAL, thanks!

BruceDai commented 3 years ago

Thanks @Honry.

I verified locally on browser http://127.0.0.1:8080/test/?backend=wasm with workload

--- a/src/nn/context.ts
+++ b/src/nn/context.ts
@@ -63,7 +63,7 @@ export class MLContext {
   get tf(): unknown {
     // Set directory of wasm binaries for 'wasm' backend
     wasm.setWasmPaths(
-        'https://webmachinelearning.github.io/webnn-polyfill/dist/');
+        'http://127.0.0.1:8080/dist/');
     return tf;
   }
 }

Now test result of total 615 tests: passes: 566 failures: 48 pending: 1

The failures tests are

cts-error-messages

Honry commented 3 years ago

Thanks @BruceDai ! Are all the failure tests expected for wasm backend?

Honry commented 3 years ago

@huningxin, thanks for your comments, fixed the nits, PTAL again, thanks!

Honry commented 3 years ago

@huningxin, I've updated the PR to reuse the wasm binaries from TensorFlow.js, PTAL, thanks!