Repro Steps:
- Run WebNN on a NPU supported device e.g. Intel LNL
- Enable WebNN on Chrome Canary
- Visit Image Classification demo on NPU https://microsoft.github.io/webnn-developer-preview/demos/image-classification/?provider=webnn&devicetype=npu&model=mobilenet-v2&run=1
- Click
Classify button
Actual Result
PASS
Repro Steps: (cont.)
- Click
WebNN GPU button
- Click
Classify button
Actual Result
Failed to execute 'dispatch' on 'MLContext': Invalid inputs: The context of MLGraph doesn't match the context of the MLTensor with name "pixel_values"
Note
Error also occurs when switching from WebNN GPU to WebNN NPU
Environment
- Google Chrome Version 133.0.6887.4 (Official Build) canary (64-bit)
This version of Transformers.js distribution was built using the following components:
- ONNX Runtime Web: 1.21.0-dev.20241122-a2ba3cb547
- Transformers.js: v3 branch
- Get performance data: patch
Related Issues
Related Fixes
@egalli Please help to check this issue. Thanks!
CC @fdwr @Honry

Repro Steps:
ClassifybuttonActual Result
PASSRepro Steps: (cont.)
WebNN GPUbuttonClassifybuttonActual Result
Failed to execute 'dispatch' on 'MLContext': Invalid inputs: The context of MLGraph doesn't match the context of the MLTensor with name "pixel_values"Note
Error also occurs when switching from
WebNN GPUtoWebNN NPUEnvironment
This version of Transformers.js distribution was built using the following components:
Related Issues
Related Fixes
MLContexts in theWebNNBackendonnxruntime#22510@egalli Please help to check this issue. Thanks!
CC @fdwr @Honry