commit b00b74bb054fe319859e6ad92fd7445a7cbbae70
parent 70359afbc5db8cbbb366c17f436e3e47a5072fe0
Author: junwei <junwei.fu@intel.com>
Date: Wed, 15 Oct 2025 08:44:20 +0000
Bug 1993934 [wpt PR 55361] - webnn: Enable kokoro_82m_v1_fp16 model on TFLite backend, a=testonly
Automatic update from web-platform-tests
webnn: Enable kokoro_82m_v1_fp16 model on TFLite backend
There is a issue in the decomposition of lstm [1] when running the
model.The squeeze[2] will output 1-D tensor if batchSize is 1, it will
fail to matmul a 2-D tensor because the a and b operand of WebNN
matmul[3] are at least 2-D, so remove specific size 1 dimensions at 0
axis with squeeze_dims option.
[1] https://github.com/webmachinelearning/webnn/issues/889
[2] https://www.w3.org/TR/webnn/#api-mlgraphbuilder-lstm [1]
https://source.chromium.org/chromium/chromium/src/+/main:services/webnn/tflite/graph_builder_tflite.cc;l=5699?q=SerializeSubGraphSliceSqueeze&ss=chromium%2Fchromium%2Fsrc
[3] https://www.w3.org/TR/webnn/#api-mlgraphbuilder-matmul
Bug: 446545294
Change-Id: I33eae7f3e81e8f2efac0cbe49627acabf58bed97
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/6993849
Reviewed-by: ningxin hu <ningxin.hu@intel.com>
Commit-Queue: Junwei Fu <junwei.fu@intel.com>
Reviewed-by: Reilly Grant <reillyg@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1528547}
--
wpt-commits: 59b8d7f80c56e0632c0d92e877f377a61c03e8b9
wpt-pr: 55361
Diffstat:
1 file changed, 65 insertions(+), 0 deletions(-)
diff --git a/testing/web-platform/tests/webnn/conformance_tests/lstm.https.any.js b/testing/web-platform/tests/webnn/conformance_tests/lstm.https.any.js
@@ -776,6 +776,71 @@ const lstmTests = [
}
},
{
+ 'name':
+ "lstm float32 tensors steps=2, batchSize=1 with options.bias, options.recurrentBias, options.activations=['relu', 'relu', 'relu'] and options.direction='backward'",
+ 'graph': {
+ 'inputs': {
+ 'lstmInput': {
+ 'data': [1, 2, 2, 1],
+ 'descriptor': {shape: [2, 1, 2], dataType: 'float32'}
+ },
+ 'lstmWeight': {
+ 'data': [1, -1, 2, -2, 1, -1, 2, -2, 1, -1, 2, -2, 1, -1, 2, -2],
+ 'descriptor': {shape: [1, 8, 2], dataType: 'float32'},
+ 'constant': true
+ },
+ 'lstmRecurrentWeight': {
+ 'data': [
+ 0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1,
+ 0.1, 0.1, 0.1
+ ],
+ 'descriptor': {shape: [1, 8, 2], dataType: 'float32'},
+ 'constant': true
+ },
+ 'lstmBias': {
+ 'data': [1, 2, 1, 2, 1, 2, 1, 2],
+ 'descriptor': {shape: [1, 8], dataType: 'float32'},
+ 'constant': true
+ },
+ 'lstmRecurrentBias': {
+ 'data': [1, 2, 1, 2, 1, 2, 1, 2],
+ 'descriptor': {shape: [1, 8], dataType: 'float32'},
+ 'constant': true
+ }
+ },
+ 'operators': [{
+ 'name': 'lstm',
+ 'arguments': [
+ {'input': 'lstmInput'}, {'weight': 'lstmWeight'},
+ {'recurrentWeight': 'lstmRecurrentWeight'}, {'steps': 2},
+ {'hiddenSize': 2}, {
+ 'options': {
+ 'bias': 'lstmBias',
+ 'recurrentBias': 'lstmRecurrentBias',
+ 'direction': 'backward',
+ 'activations': ['relu', 'relu', 'relu']
+ }
+ }
+ ],
+ 'outputs': ['lstmOutput1', 'lstmOutput2']
+ }],
+ 'expectedOutputs': {
+ 'lstmOutput1': {
+ 'data': [
+ 21955.08984375, 43092.29296875
+ ],
+ 'descriptor': {shape: [1, 1, 2], dataType: 'float32'}
+ },
+ 'lstmOutput2': {
+ 'data': [
+ 867.7901000976562, 1638.4901123046875
+ ],
+ 'descriptor': {shape: [1, 1, 2], dataType: 'float32'}
+ }
+ }
+ }
+ },
+ {
'name': 'lstm float32 tensors steps=2 with all options',
'graph': {
'inputs': {